tjwebb / congruence Goto Github PK
View Code? Open in Web Editor NEWValidate the structure of Javascript objects using semantic templates. Written as a lodash mixin.
Home Page: https://npmjs.org/package/congruence
Validate the structure of Javascript objects using semantic templates. Written as a lodash mixin.
Home Page: https://npmjs.org/package/congruence
Hey, TJ
Looking through your congruence/xtuple-query code and trying to do something similar. I noticed xtuple-query uses an older version of congruence that has an "or" function to support using an array as a predicate. That was removed in this commit.
I'm wanting to use the latest version of congruence but can't quite figure out how you replaced the "or" method. From what I can tell you didn't, and you expect the user to write their own "or" predicate. Is this assumption correct or am I missing something?
A good example of what I am trying to achieve is something similar to this template.
use underscore-contrib functions for predicates
Unrecoverable exception. Object function (obj) {
if (obj instanceof _) return obj;
if (!(this instanceof _)) return new _(obj);
this._wrapped = obj;
} has no method 'isObjectStrict'
Should not be possible to cause this error
TypeError: Object.keys called on non-object
at Function.keys (native)
at _testSubtree (/home/tjwebb/workspace/xtuple/xtuple/node-datasource/lib/query/node_modules/congruence/congruence.js:31:22)
at congruence.isDefined (/home/tjwebb/workspace/xtuple/xtuple/node-datasource/lib/query/node_modules/congruence/congruence.js:50:17)
at Array.every (native)
at Function._.every._.all (/home/tjwebb/workspace/xtuple/xtuple/node-datasource/lib/query/node_modules/underscore/underscore.js:193:62)
at _testSubtree (/home/tjwebb/workspace/xtuple/xtuple/node-datasource/lib/query/node_modules/congruence/congruence.js:36:14)
at Function.test (/home/tjwebb/workspace/xtuple/xtuple/node-datasource/lib/query/node_modules/congruence/congruence.js:92:12)
Currently arrays basically can only be validated with _.isArray
. Validating their elements requires additional programming logic, which diminishes the value of the template.
where meet = not disjoint, topologically-speaking
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.