Comparing version 1.1.3 to 1.2.0
@@ -95,3 +95,13 @@ /** | ||
var BUILT_INS = [Object, Array, String, Number, Boolean]; | ||
var BUILT_INS_BY_NAME = { | ||
'Object': Object, | ||
'Array': Array, | ||
'String': String, | ||
'Number': Number, | ||
'Boolean': Boolean | ||
}; | ||
var BUILT_IN_NAMES = Object.keys(BUILT_INS_BY_NAME); | ||
var BUILT_INS = BUILT_IN_NAMES.map(function (name) { | ||
return BUILT_INS_BY_NAME[name]; | ||
}); | ||
@@ -141,11 +151,12 @@ function normalizeSchema (name, node, props, fullName, env, argv) { | ||
if (BUILT_INS.indexOf(format) >= 0) { | ||
if (BUILT_INS.indexOf(format) >= 0 || BUILT_IN_NAMES.indexOf(format) >= 0) { | ||
// if the format property is a built-in JavaScript constructor, | ||
// assert that the value is of that type | ||
var Format = typeof format === 'string' ? BUILT_INS_BY_NAME[format] : format; | ||
newFormat = function(x) { | ||
assert(Object.prototype.toString.call(x) == | ||
Object.prototype.toString.call(new format()), | ||
'must be of type ' + format.name); | ||
Object.prototype.toString.call(new Format()), | ||
'must be of type ' + Format.name); | ||
}; | ||
o.format = format.name.toLowerCase(); | ||
o.format = Format.name.toLowerCase(); | ||
@@ -152,0 +163,0 @@ } else if (typeof format === 'string') { |
@@ -12,3 +12,3 @@ { | ||
], | ||
"version": "1.1.3", | ||
"version": "1.2.0", | ||
"license": "Apache-2.0", | ||
@@ -34,3 +34,5 @@ "homepage": "https://github.com/mozilla/node-convict", | ||
"clean": "rm -rf test/coverage", | ||
"version": "./changelog_assert_entries $npm_package_version" | ||
"safefreeze": "rm -rf node_modules npm-shrinkwrap.json && npm install && npm dedupe && npm test && npm shrinkwrap && touch package.json npm-shrinkwrap.json", | ||
"preversion": "./assert_shrinkwrap_ready", | ||
"version": "./assert_changelog_ready $npm_package_version" | ||
}, | ||
@@ -50,4 +52,4 @@ "files": [ | ||
"devDependencies": { | ||
"coveralls": "2.11.8", | ||
"eslint": "2.4.0", | ||
"coveralls": "2.11.9", | ||
"eslint": "2.5.3", | ||
"istanbul": "0.4.2", | ||
@@ -54,0 +56,0 @@ "mocha": "2.4.5", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38398
438