Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Haye is a simple super fast string expression parser. In support pipe
and qs
string expressions ( explained below ).
Limitations The keys/values inside the expression cannot have any of the reserved keywords, otherwise parser will mis-behave.
haye #pipeToArray x 741,030 ops/sec ±0.97% (90 runs sampled)
haye #pipeToJson x 313,101 ops/sec ±0.95% (87 runs sampled)
haye #qsToArray x 698,688 ops/sec ±0.74% (91 runs sampled)
haye #qsToJson x 303,482 ops/sec ±1.10% (89 runs sampled)
219,138 op/s » haye #pipeToArray #legacy 170,068 op/s » haye #pipeToJson #legacy 147,594 op/s » haye #qsToArray #legacy 121,094 op/s » haye #qsToJson #legacy
747,298 op/s » haye #pipeToArray 363,152 op/s » haye #pipeToJson 742,310 op/s » haye #qsToArray 349,075 op/s » haye #qsToJson
There are couple of breaking changes from 1.0.1 to 2.x.x
Arrays
and Objects
have been removed.
The pipe based expression is very popular in Laravel community, due to their Validation engine, and same is adopted by Indicative.
required|email|max:4|range:10,30
|
:
,
.The query string expression is almost similar to the URL query string, with couple of small modifications to make the expression readable.
required,email,max=4,range=[1, 10]
,
=
,
inside []
.The module is available on npm
npm i haye
# yarn
yarn add haye
Below is the bunch of usage examples
const haye = require('haye')
const expression = 'required|email:unique,users'
const parsed = haye.fromPipe(expression).toArray()
Output
[
{ name: 'required', args: [] },
{ name: 'email', args: ['unique', 'users'] }
]
const haye = require('haye')
const expression = 'required|email:unique,users'
const parsed = haye.fromPipe(expression).toJSON()
Output
{
required: [],
email: [ 'unique', 'users' ]
}
const haye = require('haye')
const expression = 'required,email=[unique,users]'
const parsed = haye.fromQS(expression).toArray()
Output
[
{ name: 'required', args: [] },
{ name: 'email', args: ['unique', 'users'] }
]
const haye = require('haye')
const expression = 'required,email=[unique,users]'
const parsed = haye.fromQS(expression).toJSON()
Output
{
required: [],
email: [ 'unique', 'users' ]
}
FAQs
Haye is a super fast string based expression parser for Node.js
The npm package haye receives a total of 30,506 weekly downloads. As such, haye popularity was classified as popular.
We found that haye demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.