chimpanzee
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -6,2 +6,5 @@ "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; }; | ||
exports.any = any; | ||
@@ -26,3 +29,4 @@ | ||
return schemas.length ? function run(schemas) { | ||
return (0, _utils.waitForSchema)(schemas[0], obj, context, function (result) { | ||
const newContext = _extends({}, context); | ||
return (0, _utils.waitForSchema)(schemas[0], obj, newContext, function (result) { | ||
return result instanceof _results.Match ? result : schemas.length > 1 ? function () { | ||
@@ -29,0 +33,0 @@ return run(schemas.slice(1)); |
@@ -26,3 +26,3 @@ "use strict"; | ||
function capture(params, options) { | ||
function capture(params) { | ||
return captureIf(function (obj) { | ||
@@ -29,0 +29,0 @@ return typeof obj !== "undefined"; |
@@ -16,2 +16,11 @@ "use strict"; | ||
var _composite = require("./composite"); | ||
Object.defineProperty(exports, "composite", { | ||
enumerable: true, | ||
get: function get() { | ||
return _composite.composite; | ||
} | ||
}); | ||
var _capture = require("./capture"); | ||
@@ -18,0 +27,0 @@ |
@@ -21,5 +21,2 @@ "use strict"; | ||
//DEBUG only | ||
let ctr = 0; | ||
function getSchemaType(schema) { | ||
@@ -31,3 +28,2 @@ return ["string", "number", "boolean", "symbol"].includes(typeof schema) ? "native" : typeof schema === "function" ? "function" : schema instanceof _schema2.default ? "schema" : Array.isArray(schema) ? "array" : typeof schema === "object" ? "object" : typeof schema; | ||
params = typeof params === "string" ? { key: params } : params; | ||
params.ctr = ctr++; | ||
params.builders = params.builders || [{ get: function get(obj, { state }) { | ||
@@ -88,3 +84,3 @@ return state; | ||
return { | ||
task: traverse(childSchema, { value: params.value, modifiers: { property: params.modifiers.property, value: params.modifiers.value }, parentCtr: params.ctr }, true).fn(childItem, getSchemaType(childSchema) === "object" ? context : { parent: context }, key), | ||
task: traverse(childSchema, { value: params.value, modifiers: { property: params.modifiers.property, value: params.modifiers.value } }, true).fn(childItem, getSchemaType(childSchema) === "object" ? context : { parent: context }, key), | ||
params: childSchema.params ? _extends({}, childSchema.params, { key: childSchema.params.key || key }) : { key } | ||
@@ -102,3 +98,3 @@ }; | ||
return { | ||
task: traverse(rhs, { value: params.value, modifiers: { property: params.modifiers.property, value: params.modifiers.value }, parentCtr: params.ctr }, false).fn(obj[i], { parent: context }), | ||
task: traverse(rhs, { value: params.value, modifiers: { property: params.modifiers.property, value: params.modifiers.value } }, false).fn(obj[i], { parent: context }), | ||
params: schema.params | ||
@@ -105,0 +101,0 @@ }; |
{ | ||
"name": "chimpanzee", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"author": "Jeswin<jeswinpk@agilehead.com>", | ||
@@ -5,0 +5,0 @@ "scripts": { |
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
136831
45
886