-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Maurits Rijk
committed
Jun 2, 2017
1 parent
39572da
commit dc57665
Showing
2 changed files
with
5 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,10 @@ | ||
const _ = require('lodash'); | ||
|
||
const {getSpec} = require('./def'); | ||
const {spec: specize} = require('./def'); | ||
|
||
function unform(spec, value) { | ||
if (_.isFunction(spec)) { | ||
return value; | ||
} else { | ||
const predicate = getSpec(spec).unform; | ||
return predicate ? predicate(value) : value; | ||
} | ||
function unform(pred, value) { | ||
const predicate = specize(pred).unform; | ||
return predicate ? predicate(value) : value; | ||
} | ||
|
||
module.exports = unform; |