Project Haystack Core
npm install @j2inn/haystack-core
npm install @j2inn/haystack-core
`
APIs
$3
The following core Haystacks are implemented...
- HVal: the base class for all haystack values.
- HStr: a string value.
- HBool: a boolean true or false value.
- HNum: a numeric value.
- HCoord: co-ordinates with latitude and longitude.
- HXStr: an xstring implementation. Supports difference types and mime types.
- HDate: a date value.
- HTime: a time value.
- HDateTime: date and time.
- HSymbol: a symbol.
- HDict: dictionary - a map of key/haystack value pairs.
- HGrid: grid - a table of haystack values.
- HList: a list of haystack values.
- HMarker: a marker value.
- HNa: a non-applicable value.
- HRef: a reference value.
- HRemove: a remove value.
- HUri: a universal resource indicator value.
Each haystack value has a kind that can be queried. A haystack value can be encoded to Zinc by calling toZinc().
To convert a Zinc back to a haystack value see ZincReader.
$3
Haystack core has full support for units. The actual unit database implementation is stored in haystack-units. This enables a developer to import the whole unit database or just the units they're interested in working in.
$3
Haystack core has comprehensive support for Haystack v4 defs. Defs add an ontology to the pre-existing haystack taxonomy that is now formalized.
- Normalization: compile a number of libraries (typically held in a trio format) into a normalized def database that can be consumed by a namespace.
- Namespace: the defs database that can be queried.
- Filter: extra haystack filter support for making semantic queries using defs.
$3
The TrioReader and TrioWriter classes are used to read and write Trio files.
$3
Hayson is an alternative JSON encoding format for Haystack that's being promoted.
Hayson has full support in Haystack Core.
$3
An abbreviated namespace of useful methods has been created to make it easier to work with in environments such as a web browser.
$3
A full haystack filter compiler implementation is included.
To work with filters please see HFilter.
- Compile a haystack filter into a node AST (abstract syntax tree).
- Evaluate a Haystack Filter against some haystack values.
- Convert an AST Node tree back into a haystack filter.
- Build a filter using HFilterBuilder`