Package Exports
- specs
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (specs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Specs
specs is a modular framework to compile specification models into javascript
functions.
Install
npm install specsUsage
var assert = require('assert');
var specs = require('specs');
var engine = specs.engine();
var spec = engine.compile({
foo: 42,
bar: /foo+bar/
});
assert(spec({
foo: 42,
bar: 'foooooooobar'
});Directives
Directives allow you to extend the grammar of your specification engine
engine.directive('lt', function (model) {
return function (x) { return x < model; };
});and use them in specification models
var spec = engine.compile({ $lt: 43 });
assert(spec(42));Modules
A module is a set of directives.
You can write your own modules or reuse existing ones.
Below are officially supported modules to come
specs-comp: basic scalar comparison operatorsspecs-logic: basic logic operatorsspecs-list: basic list operators (contains, any, none of, ...)
Module usage is then like so
var engine = specs.engine('comp', 'logic', 'list');