Skip to content

Commit d7a30ed

Browse files
committed
Changed import { Engine } from 'json-rules-engine'
to const Engine = require('json-rules-engine').Engine in readMe and examples because the latest version node throws error
1 parent 55d3efa commit d7a30ed

10 files changed

+14
-23
lines changed

Diff for: README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
![json-rules-engine](http://i.imgur.com/MAzq7l2.png)
2-
32
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
43
[![Build Status](https://travis-ci.org/CacheControl/json-rules-engine.svg?branch=master)](https://travis-ci.org/CacheControl/json-rules-engine)
54
[![npm version](https://badge.fury.io/js/json-rules-engine.svg)](https://badge.fury.io/js/json-rules-engine)
@@ -32,7 +31,8 @@ $ npm install json-rules-engine
3231
This example demonstrates an engine for detecting whether a basketball player has fouled out (a player who commits five personal fouls over the course of a 40-minute game, or six in a 48-minute game, fouls out).
3332

3433
```js
35-
import { Engine } from 'json-rules-engine'
34+
const Engine = require('json-rules-engine').Engine
35+
3636

3737
/**
3838
* Setup a new engine
@@ -108,7 +108,7 @@ Fact information is loaded via API call during runtime, and the results are cach
108108
It also demonstates use of the condition _path_ feature to reference properties of objects returned by facts.
109109

110110
```js
111-
import { Engine } from 'json-rules-engine'
111+
const Engine = require('json-rules-engine').Engine
112112

113113
// example client for making asynchronous requests to an api, database, etc
114114
import apiClient from './account-api-client'

Diff for: examples/01-hello-world.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
'use strict'
2-
32
/*
43
* This is the hello-world example from the README.
54
*
@@ -11,8 +10,8 @@
1110
*/
1211

1312
require('colors')
14-
const Engine = require('../dist').Engine
15-
const Rule = require('../dist').Rule
13+
const Engine = require('json-rules-engine').Engine
14+
const Rule = require('json-rules-engine').Rule
1615

1716
/**
1817
* Setup a new engine

Diff for: examples/02-nested-boolean-logic.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
'use strict'
2-
32
/*
43
* This example demonstates nested boolean logic - e.g. (x OR y) AND (a OR b).
54
*
@@ -11,8 +10,7 @@
1110
*/
1211

1312
require('colors')
14-
const Engine = require('../dist').Engine
15-
13+
const Engine = require('json-rules-engine').Engine
1614
/**
1715
* Setup a new engine
1816
*/

Diff for: examples/03-dynamic-facts.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
'use strict'
2-
32
/*
43
* This example demonstrates computing fact values at runtime, and leveraging the 'path' feature
54
* to select object properties returned by facts
@@ -12,7 +11,7 @@
1211
*/
1312

1413
require('colors')
15-
const Engine = require('../dist').Engine
14+
const Engine = require('json-rules-engine').Engine
1615
// example client for making asynchronous requests to an api, database, etc
1716
const apiClient = require('./support/account-api-client')
1817

Diff for: examples/04-fact-dependency.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
'use strict'
2-
32
/*
43
* This is an advanced example that demonstrates facts with dependencies
54
* on other facts. In addition, it demonstrates facts that load data asynchronously
@@ -13,7 +12,7 @@
1312
*/
1413

1514
require('colors')
16-
const Engine = require('../dist').Engine
15+
const Engine = require('json-rules-engine').Engine
1716
const accountClient = require('./support/account-api-client')
1817

1918
/**

Diff for: examples/05-optimizing-runtime-with-fact-priorities.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
'use strict'
2-
32
/*
43
* This is an advanced example that demonstrates using fact priorities to optimize the rules engine.
54
*
@@ -11,7 +10,7 @@
1110
*/
1211

1312
require('colors')
14-
const Engine = require('../dist').Engine
13+
const Engine = require('json-rules-engine').Engine
1514
const accountClient = require('./support/account-api-client')
1615

1716
/**

Diff for: examples/06-custom-operators.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
'use strict'
2-
32
/*
43
* This example demonstrates using custom operators.
54
*
@@ -17,7 +16,8 @@
1716
*/
1817

1918
require('colors')
20-
const Engine = require('../dist').Engine
19+
const Engine = require('json-rules-engine').Engine
20+
2121

2222
/**
2323
* Setup a new engine

Diff for: examples/07-rule-chaining.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
'use strict'
2-
32
/*
43
* This is an advanced example demonstrating rules that passed based off the
54
* results of other rules by adding runtime facts. It also demonstrates
@@ -13,7 +12,7 @@
1312
*/
1413

1514
require('colors')
16-
const Engine = require('../dist').Engine
15+
const Engine = require('json-rules-engine').Engine
1716

1817
/**
1918
* Setup a new engine

Diff for: examples/08-fact-comparison.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
'use strict'
2-
32
/*
43
* This is a basic example demonstrating a condition that compares two facts
54
*
@@ -11,7 +10,7 @@
1110
*/
1211

1312
require('colors')
14-
const Engine = require('../dist').Engine
13+
const Engine = require('json-rules-engine').Engine
1514

1615
/**
1716
* Setup a new engine

Diff for: examples/09-rule-results.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
'use strict'
2-
32
/*
43
* This is a basic example demonstrating how to leverage the metadata supplied by rule results
54
*
@@ -10,7 +9,7 @@
109
* DEBUG=json-rules-engine node ./examples/09-rule-results.js
1110
*/
1211
require('colors')
13-
const Engine = require('../dist').Engine
12+
const Engine = require('json-rules-engine').Engine
1413

1514
/**
1615
* Setup a new engine

0 commit comments

Comments
 (0)