idiosyncrasies
Intended to make passing complex option lists into functions easier to maintain.
Define rules by which a collection of parameters can be validated and revised to contain the desired values. Once an instance is defined the created properties will automatically validate and revise input values as they are set.
Can also apply a list of options together and each will be revised as it's set.
constructor
new Idiosyncrasies (expectation1,expectation2,..expectationN) => idiosyncrasies
Create a idiosyncrasies instance from one or more expectations. Not as forgiving as Idiosyncrasies.create() but can be used by a subtype.
static members
Idiosyncrasies.create(expectation1,expectation2,..expectationN) => idiosyncrasies
Create a idiosyncrasies instance from one or more expectations. Arguments that aren't expectations will be converted if possible.
Idiosyncrasies.fromIterable(expectations) => idiosyncrasies
Create a idiosyncrasies instance from an iterable (array, set, map, etc) of expectations.
Idiosyncrasies.fromObject(expectations) => idiosyncrasies
Create a idiosyncrasies instance from an object's properties. Will be treated as an iterable of key-value pairs.
Idiosyncrasies.defineValues(idiosyncrasies, expectations) => idiosyncrasies
Define expectation-baked properties on a idiosyncrasies instance. If value passed as instance isn't a valid instance but can be converted into one then will do so. Returns instance.
Idiosyncrasies.applyValues(idiosyncrasies, values) => idiosyncrasies
Apply a set of values to a idiosyncrasies instance. If value passed as instance isn't a valid instance but can be converted into one then will do so. Values can be a map, an object, or an iterable of key-value pairs. Should produce the same result as manually setting the values one at a time. Returns instance.
instance members
idiosyncrasies.defineValues(expectations) => idiosyncrasies
Define expectation-baked properties on a idiosyncrasies instance.
idiosyncrasies.applyValues(values) => idiosyncrasies
Apply a set of values to a idiosyncrasies instance. Values can be a map, an object, or an iterable of key-value pairs. Should produce the same result as manually setting the values one at a time. Returns itself.
Dependencies
- [expectation]
Requires Node 4 with harmony features or Traceur.
License
ISC