shotgun-query

0.1.1 • Public • Published

shotgun

Shotgun is a DSL to query an object and call a function.

Installation

npm install shotgun-query

Usage:

const expect = thing =>
    ({ equals: otherThing => thing === otherThing });
 
new Shotgun(" res.status equals 200 ")
    .eval({ res: { status: 200 } })
    .call(expect);

Convention

The function passed to .call must be of this signature:

f = (arg : any) : object => ({
    g : (...rest : any[]) : any => { ... },
    ...
});

It will be called as such:

f(a)[g](...rest)

And the evaluation is returned.

Tests

npm test

Package Sidebar

Install

npm i shotgun-query

Weekly Downloads

2

Version

0.1.1

License

MIT

Unpacked Size

3.57 kB

Total Files

5

Last publish

Collaborators

  • mkrhere