simpl-schema
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -172,4 +172,8 @@ 'use strict'; | ||
/** | ||
* @param {String} [key] One specific or generic key for which to get the schema | ||
* @returns {Object} The entire schema object or just the definition for one key | ||
* @param {String} [key] One specific or generic key for which to get the schema. | ||
* @returns {Object} The entire schema object or just the definition for one key. | ||
* | ||
* Note that this returns the raw, unevaluated definition object. Use `getDefinition` | ||
* if you want the evaluated definition, where any properties that are functions | ||
* have been run to produce a result. | ||
*/ | ||
@@ -196,2 +200,30 @@ | ||
/** | ||
* @returns {Object} The entire schema object with subschemas merged. This is the | ||
* equivalent of what schema() returned in SimpleSchema < 2.0 | ||
* | ||
* Note that this returns the raw, unevaluated definition object. Use `getDefinition` | ||
* if you want the evaluated definition, where any properties that are functions | ||
* have been run to produce a result. | ||
*/ | ||
}, { | ||
key: 'mergedSchema', | ||
value: function mergedSchema() { | ||
var mergedSchema = {}; | ||
_underscore2.default.each(this._schema, function (keySchema, key) { | ||
mergedSchema[key] = keySchema; | ||
keySchema.type.definitions.forEach(function (typeDef) { | ||
if (!(typeDef.type instanceof SimpleSchema)) return; | ||
_underscore2.default.each(typeDef.type.mergedSchema(), function (subKeySchema, subKey) { | ||
mergedSchema[key + '.' + subKey] = subKeySchema; | ||
}); | ||
}); | ||
}); | ||
return mergedSchema; | ||
} | ||
/** | ||
* Returns the evaluated definition for one key in the schema | ||
@@ -198,0 +230,0 @@ * |
{ | ||
"name": "simpl-schema", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "A schema validation package that supports direct validation of MongoDB update modifier objects.", | ||
@@ -25,3 +25,3 @@ "author": "Eric Dobbertin <aldeed@gmail.com>", | ||
"lint:fix": "eslint . --fix || true", | ||
"prepublish": "npm test && npm build", | ||
"prepublish": "npm test && npm run build", | ||
"test": "mocha --compilers js:babel-core/register --recursive 'lib/**/*.tests.js'", | ||
@@ -28,0 +28,0 @@ "test:watch": "npm test -- --watch" |
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
140361
2118