This npm module aims to give a development tools for items condition-check. The behavior emulates, for example, Typescript type-check.
The object-concepts are:
- Artifact: an item or array that fulfills certain boolean-condition;
- Collection: An artifact or array of artifacts.
The callback-concepts are:
- isArtifactCallback: 1-input/boolean-output function for respective artifact item or array;
- applyCallback: 1-input/any-output function to apply on respective artifact item or array;
The main available functionalities are:
-
Checkers:
- is: validates
candidate
withisArtifactCallback
-function to verify it is an artifact; - are: verifies if
candidate
withisArtifactCallback
-function to verify it is a collection; - has: verifies if
candidate
has valid artifact items;
- is: validates
-
catalog: applies
isArtifactCallback
boolean callback on potential {artifact, collection}-elements to validate each item individually. -
apply: applies
applyCallback
-function on artifact-candidate with validation ofisArtifactCallback
boolean callback. -
pick: pick valid artifact items according to
isArtifactCallback
boolean callback.
The interested reader may access use-cases described above on test files available on code folders below:
- Artifacts: src/__test__/artifacts.test.js
- Checkers: src/__test__/checkers.test.js
- Curators: src/__test__/curators.test.js