
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
haystack-core
Advanced tools
A core haystack implementation written in TypeScript.
This library is designed to be used in conjunction with these other haystack libraries depending on your use case...
If you're after a high performance haystack library for running on constrained devices, please see libhaystack.
npm install haystack-core
Please click here for the API documentation.
The following core Haystack types are implemented...
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.
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.
Haystack core has comprehensive support for Haystack v4 defs. Defs add an ontology to the pre-existing haystack taxonomy that is now formalized.
The TrioReader and TrioWriter classes are used to read and write Trio files.
Hayson is an alternative JSON encoding format for Haystack that's being promoted.
Hayson has full support in Haystack Core.
An abbreviated namespace of useful methods has been created to make it easier to work with in environments such as a web browser.
A full haystack filter compiler implementation is included.
To work with filters please see HFilter.
HFilterBuilderFor the full grammar, please see the class definition for the Parser.
The main class to work with is HFilter. This class contains a number of high level methods that hide the complexity of working with the underlying parser.
When a haystack filter string is parsed, it's converted into an AST (abstract syntax tree) hierarchy of Nodes.
The Node tree can be used in the following ways...
The visitor design pattern has been implemented to make it easy to generate code for different targets (i.e. a haystack filter string).
Any errors caught during parsing are thrown as LocalizedError objects. This error object contains a lexicon key and arguments used for localization as well as a possible index number. If the index number is defined, it will specify the index number of the character that caused the error in the original haystack filter.
FAQs
Project Haystack Core
The npm package haystack-core receives a total of 2,143 weekly downloads. As such, haystack-core popularity was classified as popular.
We found that haystack-core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 18 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.