Closed Olian04 closed 5 years ago
Constrain?
const { Constraint, C } = require('constrain');
const COptions = Constraint('Options', {
foo: C.Number
});
Apparently what I'm making is usually refereed to as the Specification pattern.
the specification pattern is a particular software design pattern, whereby business rules can be recombined by chaining the business rules together using boolean logic.
Maybe ryjs
[ryse] / RyJS
[ry j s]?
const { Spec, R } = require('ryjs');
const OptionSpec= Spec('Options', {
foo: R.Number
});
Or maybe we should keep Record.js
?
You define a Record type with a set of constraints describing how a record of that type should look. Then you create a Record of the given record type.
const { Record, R } = require('record.js');
const ROptions = Record('Options', {
foo: R.Number
});
Npm thinks Record.js
is to similar to Record-js
(which already exsists).
So maybe: Recordari
? From the etymologi of the word Record
.
Recordari
is latin for "remember". So the argument could be that you create a Record of an object in order to remember what it should look like, and then you can test an object to see if it fits the memory of how the object should look.
Ended up using Recordari
A "record" in computer science usually describes an immutable data-object. This project has grown more into a type and structure validation tool for configuration files.