Skip to content

Commit

Permalink
add isFunction dep
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Apr 6, 2016
1 parent a3517f6 commit aa20700
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

// TODO: Add strict mode

var isFunction = require('lodash/isfunction')
var reduce = require('lodash/reduce')
var assign = require('lodash/assign')
var flow = require('lodash/flow')
Expand Down Expand Up @@ -79,7 +80,7 @@ function Ardent (schemaBlueprint) {
var value

if (hasValue) value = rule.type(obj[name])
else if (typeof rule.default !== 'function') value = rule.default
else if (!isFunction(rule.default)) value = rule.default
else value = rule.default()

objSchema[name] = applyFilters(value)
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"chaste": "~1.1.0",
"lodash.assign": "~4.0.7",
"lodash.flow": "~3.2.1",
"lodash.isfunction": "~3.0.8",
"lodash.reduce": "~4.3.0",
"whoops": "~2.0.1"
},
Expand Down
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('schema defintion', function () {
})
})

describe('support default value', function () {
describe('support default values', function () {
it('based in a value', function () {
var schema = {
age: {
Expand Down

0 comments on commit aa20700

Please sign in to comment.