chimpanzee
Advanced tools
Comparing version 0.0.61 to 0.0.62
@@ -42,3 +42,3 @@ "use strict"; | ||
return new _schemas.FunctionSchema(fn, (0, _utils.getParams)(params), meta); | ||
} /* */ | ||
} | ||
//# sourceMappingURL=any.js.map |
@@ -29,5 +29,4 @@ "use strict"; | ||
return schema instanceof ArrayItem ? schema.fn : regularItem(schema); | ||
} /* */ | ||
} | ||
class ArrayItem { | ||
@@ -34,0 +33,0 @@ constructor(fn) { |
@@ -32,3 +32,3 @@ "use strict"; | ||
return new _array2.default(schema, (0, _utils.getParams)(params), meta); | ||
} /* */ | ||
} | ||
@@ -35,0 +35,0 @@ function func(schema, params) { |
@@ -7,5 +7,4 @@ "use strict"; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /* */ | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
exports.capture = capture; | ||
@@ -12,0 +11,0 @@ exports.captureIf = captureIf; |
@@ -48,3 +48,3 @@ "use strict"; | ||
return new _schemas.FunctionSchema(fn, (0, _utils.getParams)(params), meta); | ||
} /* */ | ||
} | ||
//# sourceMappingURL=deep.js.map |
@@ -24,3 +24,3 @@ "use strict"; | ||
return new _schemas.FunctionSchema(fn, (0, _utils.getParams)({}), meta); | ||
} /* */ | ||
} | ||
//# sourceMappingURL=empty.js.map |
@@ -20,3 +20,2 @@ "use strict"; | ||
/* */ | ||
function exists(predicate, schema) { | ||
@@ -23,0 +22,0 @@ const meta = { type: "exists", schema, predicate }; |
@@ -20,3 +20,2 @@ "use strict"; | ||
/* */ | ||
function map(schema, mapper, params) { | ||
@@ -23,0 +22,0 @@ const meta = { type: "map", schema, mapper, params }; |
@@ -20,3 +20,2 @@ "use strict"; | ||
/* */ | ||
function optional(schema, params = {}) { | ||
@@ -23,0 +22,0 @@ const meta = { type: "optional", schema, params }; |
@@ -34,3 +34,3 @@ "use strict"; | ||
return new _schemas.FunctionSchema(fn, (0, _utils.getParams)(params), { name: "regex" }); | ||
} /* */ | ||
} | ||
//# sourceMappingURL=regex.js.map |
@@ -28,3 +28,4 @@ "use strict"; | ||
return checkType("number", params); | ||
} /* */ | ||
} | ||
function bool(params) { | ||
@@ -31,0 +32,0 @@ return checkType("boolean", params); |
@@ -28,3 +28,3 @@ "use strict"; | ||
return new _schemas.FunctionSchema(fn, (0, _utils.getParams)(params), meta); | ||
} /* */ | ||
} | ||
//# sourceMappingURL=wrap.js.map |
@@ -23,3 +23,3 @@ "use strict"; | ||
return isChildLiteralObject ? new _schemas.ObjectSchema(childSource, modifiersForLiteralChildren) : Array.isArray(childSource) ? new _schemas.ArraySchema(childSource, modifiersForLiteralChildren) : typeof childSource === "string" || typeof childSource === "number" || typeof childSource === "boolean" || typeof childSource === "symbol" ? new _schemas.PrimitiveSchema(childSource, modifiersForLiteralChildren) : childSource; | ||
} /* */ | ||
} | ||
//# sourceMappingURL=literals.js.map |
@@ -7,5 +7,4 @@ "use strict"; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /* */ | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
exports.default = function (schema) { | ||
@@ -12,0 +11,0 @@ return function (_obj, key, parents, parentKeys) { |
@@ -19,3 +19,3 @@ "use strict"; | ||
} | ||
exports.default = ArraySchema; /* */ | ||
exports.default = ArraySchema; | ||
//# sourceMappingURL=array.js.map |
@@ -15,3 +15,2 @@ "use strict"; | ||
/* */ | ||
class FunctionSchema extends _schema2.default { | ||
@@ -18,0 +17,0 @@ constructor(fn, params, meta) { |
@@ -27,3 +27,3 @@ "use strict"; | ||
} | ||
exports.default = ObjectSchema; /* */ | ||
exports.default = ObjectSchema; | ||
//# sourceMappingURL=object.js.map |
@@ -15,3 +15,2 @@ "use strict"; | ||
/* */ | ||
class PrimitiveSchema extends _schema2.default { | ||
@@ -18,0 +17,0 @@ constructor(value, params, meta) { |
@@ -6,7 +6,4 @@ "use strict"; | ||
}); | ||
/* */ | ||
/* | ||
This is the base class for all schemas. | ||
*/ | ||
var _chimpanzee = require("../chimpanzee"); | ||
@@ -18,4 +15,17 @@ class Schema { | ||
} | ||
then(fnSuccessSchema, fnFailSchema) { | ||
var _this = this; | ||
return function (obj, key, parents, parentKeys) { | ||
return function (context) { | ||
const result = (0, _chimpanzee.parse)(_this)(obj, key, parents, parentKeys)(context); | ||
return result instanceof _chimpanzee.Match || result instanceof _chimpanzee.Empty ? (0, _chimpanzee.parse)(fnSuccessSchema(result.value))(obj, key, parents, parentKeys)(context) : fnFailSchema ? fnFailSchema(result) : result; | ||
}; | ||
}; | ||
} | ||
} | ||
exports.default = Schema; | ||
exports.default = Schema; /* | ||
This is the base class for all schemas. | ||
*/ | ||
//# sourceMappingURL=schema.js.map |
{ | ||
"name": "chimpanzee", | ||
"version": "0.0.61", | ||
"version": "0.0.62", | ||
"author": "Isotropy Team<isotropy@agilehead.com>", | ||
"scripts": { | ||
"build": "./build.sh", | ||
"test": "mocha dist/test/test.js", | ||
@@ -7,0 +8,0 @@ "debug": "mocha --debug-brk dist/test/test.js" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
210099
1224
76