You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 4, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+20-11Lines changed: 20 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,24 +8,33 @@ The same format can also be executed in PHP by the library [json-logic-php](http
8
8
9
9
## Installation
10
10
11
-
To parse JsonLogic rules in a JavaScript frontend, install this library is via [Bower](http://bower.io/):
11
+
To parse JsonLogic rules in a JavaScript backend (like Node.js), install this library via [NPM](https://www.npmjs.com/):
12
12
13
13
```bash
14
-
bower install --save json-logic-js
14
+
npm install @axa-ch/json-logic-js --save
15
15
```
16
16
17
-
To parse JsonLogic rules in a JavaScript backend (like Node.js), install this library via [NPM](https://www.npmjs.com/):
17
+
Note that this project provides:
18
+
- an ESM build for cherry picking
19
+
- a [module loader](http://ricostacruz.com/cheatsheets/umdjs.html) that also makes it suitable for RequireJS projects.
20
+
- a minified bundle ready for the browser
18
21
19
-
```bash
20
-
npm install json-logic-js
21
-
```
22
+
If that doesn't suit you, and you want to manage updates yourself, the entire library is self-contained in `dist/jsonLogic.js` and you can download it straight into your project as you see fit.
22
23
23
-
Note that this project uses a [module loader](http://ricostacruz.com/cheatsheets/umdjs.html) that also makes it suitable for RequireJS projects.
24
+
## Cherry-picked build
24
25
25
-
If that doesn't suit you, and you want to manage updates yourself, the entire library is self-contained in `logic.js` and you can download it straight into your project as you see fit.
26
+
If the default bundle size is too big for you or you only need certain operations, just utilize the ESM build and create your customized `jsonLogic` object as follows:
This library makes use of `Array.map` and `Array.reduce`, so it's not *exactly* Internet Explorer 8 friendly.
134
+
This library makes use of `Array.isArray`, `Array.forEach`, `Array.map` and `Array.reduce`, so it's not *exactly* Internet Explorer 8 friendly.
126
135
127
136
If you want to use JsonLogic *and* support deprecated browsers, you could easily use [BabelJS's polyfill](https://babeljs.io/docs/usage/polyfill/) or directly incorporate the polyfills documented on MDN for [map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) and [reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce).
0 commit comments