parse-condition-string
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

parse-condition-string

A package about parse condition string to js condition

how to use

transfer the conditions string like (a || b) && c, the variables of the string is the keys of the object like below

let obj = {
    a: true,
    b: false,
    c: false
}

to real javaScript conditions.

import package

const condParse = require("parse-condition-string"); // commonjs
import condParse from "parse-condition-string"; // esmodule
import condParse from "parse-condition-string"; // typescript

use

condParse("(a || b) && c", obj);
// false

Package Sidebar

Install

npm i parse-condition-string

Weekly Downloads

3

Version

1.2.0

License

MIT

Unpacked Size

23.4 kB

Total Files

8

Last publish

Collaborators

  • zhengnpm