🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

chimpanzee

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chimpanzee - npm Package Compare versions

Comparing version

to
0.0.20

2

dist/any.js

@@ -37,4 +37,4 @@ "use strict";

return new _schema2.default(fn, params);
return new _schema2.default(fn, params, { schemas });
}
//# sourceMappingURL=any.js.map

@@ -54,3 +54,3 @@ "use strict";

}(obj, [], needle);
});
}, undefined, "repeatingItem");
});

@@ -76,3 +76,3 @@ }

}(obj, 0);
});
}, undefined, "unorderedItem");
});

@@ -93,3 +93,3 @@ }

});
});
}, undefined, "optionalItem");
});

@@ -107,3 +107,3 @@ }

});
});
}, undefined, "regularItem");
};

@@ -119,15 +119,15 @@ }

*/
function array(list, params) {
function array(schemas, params) {
params = typeof params === "string" ? { key: params } : params;
const fn = function fn(obj, context, key) {
return Array.isArray(obj) ? function run(schemas, results, needle) {
const schema = toNeedledSchema(schemas[0]);
return Array.isArray(obj) ? function run(list, results, needle) {
const schema = toNeedledSchema(list[0]);
return (0, _utils.waitForSchema)(schema(needle), obj, { parent: context }, function ({ result, needle }) {
return result instanceof _results.Skip || result instanceof _results.Fault ? result : schemas.length > 1 ? run(schemas.slice(1), results.concat(result instanceof _results.Empty ? [] : [result.value]), needle) : new _results.Match(results.concat(result.value));
return result instanceof _results.Skip || result instanceof _results.Fault ? result : list.length > 1 ? run(list.slice(1), results.concat(result instanceof _results.Empty ? [] : [result.value]), needle) : new _results.Match(results.concat(result.value));
});
}(list, [], 0) : new _results.Fault(`Expected array but got ${ typeof obj }.`);
}(schemas, [], 0) : new _results.Fault(`Expected array but got ${ typeof obj }.`);
};
return new _schema3.default(fn, params);
return new _schema3.default(fn, params, params, { schemas });
}
//# sourceMappingURL=array.js.map

@@ -69,4 +69,4 @@ "use strict";

return new _schema2.default(fn, params);
return new _schema2.default(fn, params, { schema, predicate, options });
}
//# sourceMappingURL=capture.js.map

@@ -58,5 +58,4 @@ "use strict";

//return new Schema(fn, ownParams);
return (0, _traverse.traverse)(fn, ownParams);
}
//# sourceMappingURL=composite.js.map

@@ -41,4 +41,4 @@ "use strict";

return new _schema2.default(fn, params);
return new _schema2.default(fn, params, { schema });
}
//# sourceMappingURL=deep.js.map

@@ -21,4 +21,4 @@ "use strict";

return new _schema2.default(fn);
return new _schema2.default(fn, undefined, "empty");
}
//# sourceMappingURL=empty.js.map

@@ -31,4 +31,4 @@ "use strict";

return new _schema2.default(fn);
return new _schema2.default(fn, undefined, "exists");
}
//# sourceMappingURL=exists.js.map

@@ -29,4 +29,4 @@ "use strict";

return new _schema2.default(fn, params);
return new _schema2.default(fn, params, { schema });
}
//# sourceMappingURL=map.js.map

@@ -27,4 +27,4 @@ "use strict";

return new _schema2.default(fn, params);
return new _schema2.default(fn, params, { schema });
}
//# sourceMappingURL=optional.js.map

@@ -31,4 +31,4 @@ "use strict";

return new _schema2.default(fn, params);
return new _schema2.default(fn, params, { regex });
}
//# sourceMappingURL=regex.js.map

@@ -7,5 +7,6 @@ "use strict";

class Schema {
constructor(fn, params) {
constructor(fn, params, meta) {
this.fn = fn;
this.params = params;
this.meta = meta;
}

@@ -12,0 +13,0 @@ }

@@ -244,4 +244,4 @@ "use strict";

return new _schema2.default(fn, params);
return new _schema2.default(fn, params, { schema });
}
//# sourceMappingURL=traverse.js.map

@@ -55,4 +55,4 @@ "use strict";

return new _schema2.default(fn, params);
return new _schema2.default(fn, params, { type });
}
//# sourceMappingURL=types.js.map
{
"name": "chimpanzee",
"version": "0.0.19",
"version": "0.0.20",
"author": "Jeswin<jeswinpk@agilehead.com>",

@@ -5,0 +5,0 @@ "scripts": {

@@ -411,2 +411,34 @@ chimpanzee

### Composite Schemas: composite(schema, traversalParams, [ownParams])
Let's you apply multiple traversal strategies on a single tree.
Traversal options are specified via a selector. { selector: <name> }
In the following example the property "prop" is traversed without any modifiers,
since the selector is set to "alt".
If ownParams are set, the consolidated result of traversals can be modified again.
```
const input = {
node: {
something: "else",
jeff: "buckley",
hello: "world",
},
prop: "something"
}
const schema = composite(
{
something: "else",
hello: capture({ key: "first" }),
prop: capture({ key: "second", selector: "alt" })
},
[
{ name: "default", modifiers: { object: x => x.node } },
{ name: "alt" },
]
)
```
### Advanced

@@ -413,0 +445,0 @@ Property Modifier. Use this if your input tree isn't a simple object.

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