Skip to content

Commit

Permalink
First ActiveRules rules example
Browse files Browse the repository at this point in the history
  • Loading branch information
bwinkers committed Aug 1, 2018
1 parent 27bc557 commit 6c434b0
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions examples/weekday_example2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
'use strict'

/*
* Usage:
* node ./examples/weekday_example.js
*/
require('colors')
const ActiveRules = require('../src/ActiveRules.js')
const AR = new ActiveRules()
const weekday = require('./rules/weekday.json')
const weekend = require('./rules/weekend.json')

const rules = [weekday, weekend];

const days = [
{ dayOfWeek: 'Monday'},
{ dayOfWeek: 'Tuesday'},
{ dayOfWeek: 'Wednesday'},
{ dayOfWeek: 'Thursday'},
{ dayOfWeek: 'Friday'},
{ dayOfWeek: 'Saturday'},
{ dayOfWeek: 'Sunday'}
]

days.forEach(data => {
AR.run(rules, data)
.then(rulesResult => {
console.log(rulesResult)
})
})

0 comments on commit 6c434b0

Please sign in to comment.