Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chr

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chr - npm Package Compare versions

Comparing version 3.3.19 to 3.3.20

test/cli/gcd.chr

13

bin/chr.js
#!/usr/bin/env node
var program = require('commander')
var concat = require('concat-stream')
var compile = require('../compile')
const program = require('commander')
const concat = require('concat-stream')
const compile = require('../compile')

@@ -20,6 +20,7 @@ function onFinish (err, code) {

.option('-f, --function [expr]', 'Bind the CHR solver to this function')
.option('-r, --runtime [expr]', 'Bind the CHR runtime to this function', "require('chr/runtime')")
.parse(process.argv)
var file = program.args[0]
var opts = program
const file = program.args[0]
const opts = program.opts()

@@ -30,5 +31,5 @@ if (file) {

process.stdin.pipe(concat({ encoding: 'string' }, function (source) {
var code = compile(source, opts)
const code = compile(source, opts)
onFinish(null, code)
}))
}

@@ -1,2 +0,2 @@

var required = {
const required = {
chr: require('./console/chr'),

@@ -6,4 +6,4 @@ store: require('./console/store')

var config = {}
for (var key in required) {
const config = {}
for (const key in required) {
config[key.replace(/^array\./, 'array:')] = required[key]

@@ -10,0 +10,0 @@ }

@@ -1,5 +0,5 @@

var store = require('./store')
const store = require('./store')
var config = {}
for (var key in store) {
const config = {}
for (const key in store) {
config[key] = store[key]

@@ -6,0 +6,0 @@ }

@@ -1,3 +0,3 @@

var colors = require('colors') // eslint-disable-line no-unused-vars
var Store = require('../src/store')
const colors = require('colors') // eslint-disable-line no-unused-vars
const Store = require('../src/store')

@@ -20,5 +20,5 @@ module.exports = {

var store = this._store
for (var id in store) {
var tableRow = fields.map(function cell (fieldName, rowNo) {
const store = this._store
for (const id in store) {
const tableRow = fields.map(function cell (fieldName, rowNo) {
return object.fields[fieldName].call(store[id], rowNo)

@@ -25,0 +25,0 @@ })

{
"name": "chr",
"version": "3.3.19",
"version": "3.3.20",
"description": "Interpreter for Constraint Handling Rules (CHR) in JavaScript",

@@ -20,3 +20,5 @@ "main": "src/index.js",

"pretest": "npm run peg; npm run browserify",
"test": "npm run standard && npm run tape"
"test": "npm run standard && npm run tape && npm run test-cli",
"test-cli": "node ./bin/chr.js --runtime \"require('../../runtime')\" test/cli/gcd.chr | cmp -s test/cli/gcd.js -",
"create-test-cli": "node ./bin/chr.js --runtime \"require('../../runtime')\" test/cli/gcd.chr > test/cli/gcd.js"
},

@@ -43,3 +45,3 @@ "bin": {

"devDependencies": {
"browserify": "^16.5.0",
"browserify": "^17.0.0",
"browserify-versionify": "^1.0.6",

@@ -49,6 +51,6 @@ "colors": "^1.0.3",

"pegjs": "^0.10.0",
"standard": "^14.1.0",
"standard": "^16.0.3",
"tape": "^5.0.1",
"tconsole": "^1.0.0",
"uglify-es": "^3.3.10",
"uglify-js": "^3.13.4",
"uglifyify": "^5.0.0"

@@ -58,3 +60,3 @@ },

"char-spinner": "^1.0.1",
"commander": "^6.2.0",
"commander": "^7.2.0",
"concat-stream": "^2.0.0",

@@ -68,5 +70,6 @@ "easy-table": "^1.1.1",

"src/compile/fake-scope.js",
"dist/**.js"
"dist/*.js",
"test/cli/*.js"
]
}
}
module.exports = parse
module.exports.element = getElementParser
var path = require('path')
var fs = require('fs')
var PEG = require('pegjs')
const path = require('path')
const fs = require('fs')
const PEG = require('pegjs')
var parser = require('./src/parser.peg.js')
const parser = require('./src/parser.peg.js')

@@ -19,5 +19,5 @@ function parse (src, elementName) {

function getElementParser (elementName) {
var parserSource = fs.readFileSync(path.join(__dirname, 'src', 'parser.pegjs'), 'utf8')
const parserSource = fs.readFileSync(path.join(__dirname, 'src', 'parser.pegjs'), 'utf8')
var customParser = PEG.generate(parserSource, {
const customParser = PEG.generate(parserSource, {
allowedStartRules: [

@@ -24,0 +24,0 @@ elementName

module.exports = Repl
var repl = require('repl')
var spinner = require('char-spinner')
var CHR = require('./src/index')
var parse = require('./src/repl.peg.js').parse
const repl = require('repl')
const spinner = require('char-spinner')
const CHR = require('./src/index')
const parse = require('./src/repl.peg.js').parse
function Repl () {
var chr = new CHR()
const chr = new CHR()
var r = repl.start({
const r = repl.start({
prompt: 'CHR > ',

@@ -17,4 +17,4 @@ input: process.stdin,

cmd = cmd.trim()
var re
var ruleName
let re
let ruleName

@@ -48,3 +48,3 @@ // is it a special command?

ruleName = cmd.replace(re, '$1')
var functor = cmd.replace(re, '$2')
let functor = cmd.replace(re, '$2')

@@ -56,3 +56,3 @@ if (!chr.Rules[ruleName]) {

var occurrence = null
let occurrence = null
re = /^(.*)\[([0-9]+)\]$/

@@ -85,8 +85,9 @@ if (re.test(cmd)) {

// try Program
let rules, queries
try {
var rules = parse(cmd, { startRule: 'Program' })
rules = parse(cmd, { startRule: 'Program' })
} catch (e) {
// try Query
try {
var queries = parse(cmd, { startRule: 'Query' })
queries = parse(cmd, { startRule: 'Query' })
} catch (e) {

@@ -101,9 +102,9 @@ // no query

// run query
var spin = spinner({
const spin = spinner({
stream: r.outputStream
})
var queryPromise = queries.reduce(function (promise, query) {
const queryPromise = queries.reduce(function (promise, query) {
return promise.then(function () {
var chrCmd = 'chr.' + query.original
let chrCmd = 'chr.' + query.original
if (query.original.slice(-1)[0] !== ')') {

@@ -146,3 +147,3 @@ chrCmd += '()'

if (e.match(/^TypeError: chr\..* is not a function$/)) {
var constraint = e.replace(/^TypeError: chr\.(.*) is not a function$/, '$1')
const constraint = e.replace(/^TypeError: chr\.(.*) is not a function$/, '$1')
return 'Undefined constraint: ' + constraint

@@ -149,0 +150,0 @@ }

@@ -1,5 +0,5 @@

var History = require('./src/history')
var Store = require('./src/store')
var Constraint = require('./src/constraint')
var dynamicCaller = require('./src/dynamic-caller')
const History = require('./src/history')
const Store = require('./src/store')
const Constraint = require('./src/constraint')
const dynamicCaller = require('./src/dynamic-caller')

@@ -26,3 +26,3 @@ module.exports = {

function forEach (arr, iterator, onEnd) {
var indexes = Array.apply(null, Array(arr.length)).map(Number.prototype.valueOf, 0)
const indexes = Array.apply(null, Array(arr.length)).map(Number.prototype.valueOf, 0)
forEachOnIndex(arr, indexes, iterator, onEnd)

@@ -32,9 +32,9 @@ }

function forEachOnIndex (arr, indexes, iterator, onEnd) {
var iterablePosition = -1
var values = []
var value
var ix
let iterablePosition = -1
const values = []
let value
let ix
var disjoint = true
for (var position = 0; position < indexes.length; position++) {
let disjoint = true
for (let position = 0; position < indexes.length; position++) {
ix = indexes[position]

@@ -67,3 +67,3 @@

indexes[iterablePosition] += 1
for (var ix = iterablePosition + 1; ix < indexes.length; ix++) {
for (let ix = iterablePosition + 1; ix < indexes.length; ix++) {
indexes[ix] = 0

@@ -70,0 +70,0 @@ }

module.exports = Compiler
var util = require('./util')
var fakeScope = require('./fake-scope')
const util = require('./util')
const fakeScope = require('./fake-scope')
var indent = util.indent
var indentBy = util.indentBy
var destructuring = util.destructuring
var escape = util.escape
const indent = util.indent
const indentBy = util.indentBy
const destructuring = util.destructuring
const escape = util.escape

@@ -27,6 +27,6 @@ function Compiler (rule, opts) {

Compiler.prototype.headNo = function compileHeadNo (headNo) {
var self = this
const self = this
headNo = headNo || 0
var rule = this.rule
var opts = this.opts
const rule = this.rule
const opts = this.opts

@@ -37,3 +37,3 @@ if (!rule.head[headNo]) {

var constraint = rule.head[headNo]
const constraint = rule.head[headNo]
if (constraint.type !== 'Constraint') {

@@ -43,4 +43,4 @@ throw new Error('No constraint at number ' + headNo)

var parts = []
var level = 0
let parts = []
let level = 0

@@ -65,3 +65,3 @@ parts.push(

rule.head.forEach(function (head, headIndex) {
var line = headIndex === 0 ? indent(1) : ', '
let line = headIndex === 0 ? indent(1) : ', '
if (headIndex === headNo) {

@@ -143,3 +143,3 @@ line += '[ constraint.id ]'

)
for (var k = rule.r + 1; k <= rule.head.length; k++) {
for (let k = rule.r + 1; k <= rule.head.length; k++) {
// remove constraints

@@ -189,4 +189,4 @@ parts.push(

Compiler.prototype.generateGuardPromisesArray = function generateGuardPromisesArray () {
var self = this
var parts = []
const self = this
let parts = []

@@ -198,8 +198,8 @@ parts.push(

this.rule.guard.forEach(function (guard, guardIndex) {
var expr = guardIndex === 0 ? indent(1) : ', '
const expr = guardIndex === 0 ? indent(1) : ', '
if (guard.type === 'Replacement' && typeof guard.num !== 'undefined') {
// get parameters via dependency injection
var params = util.getFunctionParameters(self.replacements[guard.num])
var lastParamName = util.getLastParamName(params)
const params = util.getFunctionParameters(self.replacements[guard.num])
const lastParamName = util.getLastParamName(params)
parts.push(

@@ -239,7 +239,7 @@ expr + 'new Promise(function (s, j) {',

Compiler.prototype.generateGuards = function generateGuards () {
var self = this
var rule = this.rule
const self = this
const rule = this.rule
var expr = 'if ('
var boolExprs = []
let expr = 'if ('
const boolExprs = []
rule.guard.forEach(function (guard) {

@@ -264,4 +264,4 @@ if (guard.type !== 'Replacement') {

Compiler.prototype.generateTellPromises = function generateTellPromises () {
var self = this
var parts = []
const self = this
let parts = []

@@ -278,3 +278,3 @@ parts.push('Promise.resolve()')

if (body.type === 'Constraint') {
var expr = indent(1) + 'return self.' + body.name + '('
let expr = indent(1) + 'return self.' + body.name + '('
expr += body.parameters.map(function (parameter) {

@@ -300,4 +300,4 @@ return self.generateExpression(parameter)

var params
var lastParamName
let params
let lastParamName

@@ -370,5 +370,5 @@ if (body.type === 'Replacement' && typeof body.num !== 'undefined') {

Compiler.prototype.generateTell = function generateTell (body) {
var self = this
const self = this
var expr = ''
let expr = ''
if (body.type === 'Constraint') {

@@ -402,3 +402,3 @@ expr += 'self.' + body.name + '('

Compiler.prototype.generateBinaryExpression = function generateBinaryExpression (expr) {
var self = this
const self = this

@@ -415,2 +415,3 @@ return ['left', 'right'].map(function (part) {

}
return ''
}).join(' ' + expr.operator + ' ')

@@ -417,0 +418,0 @@ }

module.exports = transform
module.exports.fromFile = transformFile
var fs = require('fs')
const fs = require('fs')
var parse = require('../parser.peg.js').parse
var util = require('./util')
var HeadCompiler = require('./head')
var transformOptimized = require('./optimized')
const parse = require('../parser.peg.js').parse
const util = require('./util')
const HeadCompiler = require('./head')
const transformOptimized = require('./optimized')
var indent = util.indent
var indentBy = util.indentBy
const indent = util.indent
const indentBy = util.indentBy

@@ -23,7 +23,7 @@ function transform (program, opts) {

var parsed = parse(program, {
const parsed = parse(program, {
startRule: 'ProgramWithPreamble'
})
var parts = []
let parts = []

@@ -36,3 +36,3 @@ parts.push(

parts.push(opts.exports + ' = (function() {')
var level = 1
const level = 1

@@ -44,12 +44,12 @@ if (parsed.preamble) {

var constraints = {}
var constraintNames = {}
var replacements = []
const constraints = {}
const constraintNames = {}
const replacements = []
var rules = parsed.body
const rules = parsed.body
rules.forEach(function (ruleObj) {
var head
var functor
var name
var compiled
let head
let functor
let name
let compiled

@@ -64,3 +64,3 @@ // replace replacements

var src = element.original
let src = element.original
if (location === 'guard') {

@@ -70,4 +70,4 @@ src = 'return ' + src

var replacementId = replacements.push(src) - 1
var newElement = {
const replacementId = replacements.push(src) - 1
const newElement = {
type: 'Replacement',

@@ -80,7 +80,7 @@ num: replacementId

var headCompiler = new HeadCompiler(ruleObj, {
const headCompiler = new HeadCompiler(ruleObj, {
replacements: replacements
})
for (var headNo = ruleObj.head.length - 1; headNo >= 0; headNo--) {
for (let headNo = ruleObj.head.length - 1; headNo >= 0; headNo--) {
head = ruleObj.head[headNo]

@@ -104,3 +104,3 @@ functor = head.functor

// add callers if not present
var name = functor.split('/')[0]
const name = functor.split('/')[0]
if (!constraintNames[name]) {

@@ -118,8 +118,8 @@ constraintNames[name] = true

var activates
for (var functor in constraints) {
let activates
for (const functor in constraints) {
activates = []
constraints[functor].forEach(function (occurrenceFunctionSource, occurrence) {
var functionName = '_' + functor.replace('/', '_') + '_' + occurrence
const functionName = '_' + functor.replace('/', '_') + '_' + occurrence
activates.push(functionName)

@@ -137,3 +137,3 @@

parts.push(indent(level + 1) + 'return [')
activates.map(function (activatorName, ix) {
activates.forEach(function (activatorName, ix) {
parts.push(indent(level + 1) + (ix > 0 ? ', ' : ' ') + activatorName)

@@ -155,3 +155,3 @@ })

for (var constraintName in constraintNames) {
for (const constraintName in constraintNames) {
parts = parts.concat(generateCaller(opts, constraintName).map(indentBy(level)))

@@ -170,3 +170,3 @@ parts.push(indent(level))

function generateObject (opts, constraints, replacements) {
var parts = []
const parts = []

@@ -181,4 +181,4 @@ parts.push(

var functorNo = 0
for (var functor in constraints) {
let functorNo = 0
for (const functor in constraints) {
parts.push((functorNo++ > 0 ? indent(1) + ', ' : indent(2)) + '"' + functor + '": [')

@@ -213,3 +213,3 @@ constraints[functor].forEach(function (o, occurrence) {

function generateCaller (opts, name) {
var parts = []
const parts = []

@@ -243,3 +243,3 @@ parts.push(

var result
let result
try {

@@ -246,0 +246,0 @@ result = transform(code, opts)

@@ -22,3 +22,3 @@ /* eslint no-labels: ["error", { "allowLoop": true }] */

Constraint.prototype.toString = function () {
var s = this.name
let s = this.name
if (this.arity >= 1) {

@@ -49,3 +49,3 @@ s += '(' + this.args.join(',') + ')'

constraint.alive = false
var ix = this._index[constraint.functor].indexOf(constraint)
const ix = this._index[constraint.functor].indexOf(constraint)
this._index[constraint.functor].splice(ix, 1)

@@ -57,3 +57,3 @@

Store.prototype.lookup = function (rule, patterns, constraint) {
var ret = this.lookupResume(rule, patterns, constraint, 0)
const ret = this.lookupResume(rule, patterns, constraint, 0)
if (!ret || !ret.res) {

@@ -68,10 +68,10 @@ return false

var lastPattern = patterns.length - 1
var lengths = []
var divs = []
var div = 1
var i
const lastPattern = patterns.length - 1
const lengths = []
const divs = []
let div = 1
let i
// build array of arrays
var arr = []
const arr = []
for (i = 0; i <= lastPattern; i++) {

@@ -94,8 +94,8 @@ if (patterns[i] === '_') {

}
var max = divs[0] * arr[0].length
const max = divs[0] * arr[0].length
var res
var resIds
var curr
loopng: for (var n = startFrom; n < max; n++) {
let res
let resIds
let curr
loopng: for (let n = startFrom; n < max; n++) {
res = []

@@ -144,9 +144,9 @@ resIds = []

var maxLengthC = 'constraint'.length
var maxLengthI = 'id'.length
var rows = []
var functor
let maxLengthC = 'constraint'.length
let maxLengthI = 'id'.length
const rows = []
let functor
for (functor in this._index) {
this._index[functor].forEach(function (c) {
var s = c.toString()
const s = c.toString()
maxLengthC = Math.max(s.length, maxLengthC)

@@ -238,3 +238,3 @@ maxLengthI = Math.max(c.id.toString().length + 1, maxLengthI)

function trampoline () { // eslint-disable-line
var constraint
let constraint
while (constraint = stack.pop()) { // eslint-disable-line

@@ -249,3 +249,3 @@ constraint.continue()

var stack = []
var stack = [] // eslint-disable-line
// var history = new History()
module.exports = transform
module.exports.Compiler = Compiler
var fs = require('fs')
var path = require('path')
const fs = require('fs')
const path = require('path')
var parse = require('../parser.peg.js').parse
var util = require('./util')
const parse = require('../parser.peg.js').parse
const util = require('./util')
var version = require('../../package.json').version
const version = require('../../package.json').version
var indent = util.indent
var indentBy = util.indentBy
var destructuring = util.destructuring
var escape = util.escape
const indent = util.indent
const indentBy = util.indentBy
const destructuring = util.destructuring
const escape = util.escape
function transform (program, opts) {
var compiler = new Compiler(program, opts)
const compiler = new Compiler(program, opts)
return compiler.compile()

@@ -27,3 +27,3 @@ }

var parsed = parse(program, {
const parsed = parse(program, {
startRule: 'ProgramWithPreamble'

@@ -40,3 +40,3 @@ })

Compiler.prototype.compile = function () {
var self = this
const self = this

@@ -68,3 +68,3 @@ this.parts = []

var l = 1
const l = 1

@@ -74,3 +74,3 @@ this.addStatics(l)

// handle all rules
var rules = this.parsed.body
const rules = this.parsed.body
rules.forEach(function (ruleObj) {

@@ -88,5 +88,5 @@ // add unique id

// add callers if not present
var p = functor.split('/')
var name = p[0]
var arity = p[1]
const p = functor.split('/')
const name = p[0]
const arity = p[1]
if (typeof self.constraints[name] === 'undefined') {

@@ -101,3 +101,3 @@ self.constraints[name] = {}

// add functions
for (var headNo = ruleObj.head.length - 1; headNo >= 0; headNo--) {
for (let headNo = ruleObj.head.length - 1; headNo >= 0; headNo--) {
self.addHeadFunction(1, ruleObj, headNo)

@@ -120,3 +120,3 @@ }

Compiler.prototype.addNotice = function (level) {
var l = level || 0
const l = level || 0

@@ -139,5 +139,5 @@ this.parts.push(

Compiler.prototype.addStatics = function (level) {
var l = level || 0
const l = level || 0
var statics = fs.readFileSync(path.join(__dirname, 'optimized-statics.js'), 'utf8')
const statics = fs.readFileSync(path.join(__dirname, 'optimized-statics.js'), 'utf8')
this.parts = this.parts.concat(statics.split('\n').map(indentBy(l)))

@@ -147,17 +147,17 @@ }

Compiler.prototype.addHeadFunction = function (level, ruleObj, headNo) {
var self = this
var l = level || 0
var _str // only temp str
var _sthAdded = false
const self = this
let l = level || 0
let _str // only temp str
let _sthAdded = false
var head = ruleObj.head[headNo]
var functor = head.functor
var p = functor.split('/')
var name = p[0]
var arity = p[1]
var no = this.constraints[name][arity]
const head = ruleObj.head[headNo]
const functor = head.functor
const p = functor.split('/')
const name = p[0]
const arity = p[1]
const no = this.constraints[name][arity]
var _currentConstraintGetsRemoved = false
var _hadLookup = false
var _breakCmds
let _currentConstraintGetsRemoved = false
let _hadLookup = false
let _breakCmds

@@ -247,3 +247,3 @@ this.parts.push(

if (ruleObj.r < ruleObj.head.length) {
for (var k = ruleObj.r + 1; k <= ruleObj.head.length; k++) {
for (let k = ruleObj.r + 1; k <= ruleObj.head.length; k++) {
if ((k - 1) === headNo) {

@@ -299,4 +299,4 @@ // do nothing here - this is handled

Compiler.prototype.addTell = function (level, body) {
var self = this
var l = level || 0
const self = this
const l = level || 0

@@ -308,3 +308,3 @@ if (body.type === 'Constraint' && body.name === 'true' && body.arity === 0) {

if (body.type === 'Constraint') {
var args = body.parameters.map(function (parameter) {
const args = body.parameters.map(function (parameter) {
return Compiler.generateExpression(parameter)

@@ -323,4 +323,4 @@ }).join(', ')

var params
var lastParamName
let params
let lastParamName

@@ -360,7 +360,7 @@ if (body.type === 'Replacement' && typeof body.num !== 'undefined') {

Compiler.prototype.addLastHeadFunctions = function (level) {
var self = this
var l = level || 0
const self = this
const l = level || 0
for (var constraintName in self.constraints) {
for (var arity in self.constraints[constraintName]) {
for (const constraintName in self.constraints) {
for (const arity in self.constraints[constraintName]) {
this.parts.push(

@@ -378,4 +378,4 @@ indent(l) + 'function ' + Compiler.getContinuationReference(constraintName, arity, self.constraints[constraintName][arity]) + ' (constraint) {',

Compiler.prototype.addConstraintProperties = function (level) {
var self = this
var l = level || 0
const self = this
const l = level || 0

@@ -395,4 +395,4 @@ // bind callers to `chr` variable

Compiler.prototype.addConstraintCallers = function (level) {
var self = this
var l = level || 0
const self = this
const l = level || 0

@@ -422,8 +422,8 @@ // create functions

Compiler.prototype.addConstraintContinuations = function (level, constraintName) {
var self = this
var l = level || 0
const self = this
const l = level || 0
var constraint = this.constraints[constraintName]
const constraint = this.constraints[constraintName]
var arities = Object.keys(constraint)
const arities = Object.keys(constraint)
if (arities.length === 1) {

@@ -459,6 +459,6 @@ self.parts.push(

Compiler.prototype.addGuards = function (level, ruleObj, name, arity, no, _hadLookup) {
var l = level || 0
const l = level || 0
var expr = 'if (!('
var boolExprs = []
let expr = 'if (!('
const boolExprs = []
ruleObj.guard.forEach(function (guard) {

@@ -495,3 +495,3 @@ if (guard.type !== 'Replacement') {

Compiler.getJumper = function (name, arity, no, _hadLookup) {
var parts = []
const parts = []

@@ -535,2 +535,3 @@ if (_hadLookup === true) {

}
return ''
}).join(' ' + expr.operator + ' ')

@@ -537,0 +538,0 @@ }

@@ -40,3 +40,3 @@ module.exports = {}

var parts = []
let parts = []
constraint.parameters.forEach(function (parameter, i) {

@@ -54,3 +54,3 @@ if (parameter.type === 'Literal') {

var name = parameter.name
let name = parameter.name
if (parameter.type === 'ArrayExpression') {

@@ -57,0 +57,0 @@ parts.push('', '// Note: This feature needs native Destructuring (Array value).')

@@ -16,3 +16,3 @@ module.exports = Constraint

Constraint.prototype.toString = function toString () {
var res = this.name
let res = this.name
if (this.arity > 0) {

@@ -27,3 +27,3 @@ res += '('

function escape (val) {
var res = JSON.stringify(val)
let res = JSON.stringify(val)
if (typeof res !== 'string') {

@@ -30,0 +30,0 @@ res = '"' + val.toString() + '"'

module.exports = dynamicCaller
var Constraint = require('./constraint')
const Constraint = require('./constraint')
function dynamicCaller (name) {
return function () {
var args = Array.prototype.slice.call(arguments)
var arity = arguments.length
var functor = name + '/' + arity
const args = Array.prototype.slice.call(arguments)
const arity = arguments.length
const functor = name + '/' + arity

@@ -15,6 +15,6 @@ if (typeof this.Constraints[functor] === 'undefined') {

var constraint = new Constraint(name, arity, args)
const constraint = new Constraint(name, arity, args)
this.Store.add(constraint)
var rules = []
const rules = []
this.Rules.ForEach(function (rule) {

@@ -26,3 +26,3 @@ if (rule[functor]) {

var self = this
const self = this

@@ -29,0 +29,0 @@ return rules.reduce(function (curr, rule) {

@@ -12,3 +12,3 @@ module.exports = History

var str = hash(ids)
const str = hash(ids)
this._history[rule].push(str)

@@ -22,4 +22,4 @@ }

var str = hash(ids)
var found = (this._history[rule].indexOf(str) >= 0)
const str = hash(ids)
const found = (this._history[rule].indexOf(str) >= 0)
return !found

@@ -33,4 +33,4 @@ }

var str = hash(ids)
var found = (this._history[rule].indexOf(str) >= 0)
const str = hash(ids)
const found = (this._history[rule].indexOf(str) >= 0)
return found

@@ -37,0 +37,0 @@ }

;(function () {
var root = this
var prevCHR
const root = this
let prevCHR
if (root && root.CHR) {

@@ -8,8 +8,8 @@ prevCHR = root.CHR

var Runtime = require('../runtime')
var Rules = require('./rules')
var Rule = require('./rule')
var joinParts = require('./join-parts')
const Runtime = require('../runtime')
const Rules = require('./rules')
const Rule = require('./rule')
const joinParts = require('./join-parts')
var parse
let parse
if (process.env.NODE_ENV === 'browserWithoutParser') {

@@ -32,4 +32,4 @@ parse = root.parseCHR

function tag (chrSource) {
var program
var replacements
let program
let replacements

@@ -51,3 +51,3 @@ // Examine caller format

// or tag`a ==> ${ function() { console.log('Replacement test') } }`
var combined = [
const combined = [
chrSource[0]

@@ -80,3 +80,3 @@ ]

var rules = program.body
const rules = program.body
rules.forEach(function (rule) {

@@ -83,0 +83,0 @@ tag.Rules.Add(rule, replacements)

module.exports = joinParts
function joinParts (arr) {
var res = arr[0].trim()
var replacementNo = 0
let res = arr[0].trim()
let replacementNo = 0

@@ -14,3 +14,3 @@ arr.forEach(function (el, ix) {

if (typeof el === 'string') {
var str = el.trim()
const str = el.trim()
if (str.length === 0) {

@@ -17,0 +17,0 @@ return

module.exports = Rule
var uuid = require('uuid').v1
const uuid = require('uuid').v1
var HeadCompiler = require('./compile/head')
const HeadCompiler = require('./compile/head')

@@ -32,8 +32,8 @@ function Rule (ruleObj, opts) {

Rule.prototype._compile = function compileRule (ruleObj) {
var self = this
const self = this
var head
var compiled
let head
let compiled
var headCompiler = new HeadCompiler(ruleObj, {
const headCompiler = new HeadCompiler(ruleObj, {
replacements: self.Replacements,

@@ -43,3 +43,3 @@ scope: self.Scope

for (var headNo = ruleObj.head.length - 1; headNo >= 0; headNo--) {
for (let headNo = ruleObj.head.length - 1; headNo >= 0; headNo--) {
head = ruleObj.head[headNo]

@@ -69,3 +69,3 @@

for (var key in data) {
for (const key in data) {
compiledFunction[key] = data[key]

@@ -82,3 +82,3 @@ }

Rule.prototype._setReplacements = function (globalReplacements) {
var self = this
const self = this

@@ -91,3 +91,3 @@ ;['guard', 'body'].forEach(function (location) {

var replacementId
let replacementId

@@ -106,3 +106,3 @@ if (typeof el.num !== 'undefined') {

// attention: this mutates the globalReplacement parameter!
var replacement = globalReplacements.shift()
const replacement = globalReplacements.shift()

@@ -114,3 +114,3 @@ // get free uuid

// adapt source object
var newElement = {
const newElement = {
type: 'Replacement',

@@ -129,5 +129,5 @@ num: replacementId

Rule.prototype.ForEach = function forEach (callback, thisArg) {
var self = this
const self = this
for (var functor in self) {
for (const functor in self) {
if (!functor.match(/^[a-z]/)) {

@@ -142,4 +142,4 @@ continue

Rule.prototype.Fire = function fireConstraint (chr, constraint) {
var self = this
var replacements = this.Replacements
const self = this
const replacements = this.Replacements

@@ -152,3 +152,3 @@ return Promise.resolve().then(callback2Promise({

}, this.Breakpoints.onTry)).then(function () {
var occurrences = self[constraint.functor].length - 1
const occurrences = self[constraint.functor].length - 1

@@ -170,3 +170,3 @@ return self[constraint.functor].reduce(function (promise, occurrence, ix) {

function callback2Promise () {
var f = Array.prototype.slice.call(arguments, -1)[0]
const f = Array.prototype.slice.call(arguments, -1)[0]
if (!f) {

@@ -178,4 +178,4 @@ return function () {

var self = this
var data = Array.prototype.slice.call(arguments, 0, -1)
const self = this
const data = Array.prototype.slice.call(arguments, 0, -1)
return function () {

@@ -182,0 +182,0 @@ return new Promise(function (resolve) {

module.exports = Rules
var dynamicCaller = require('./dynamic-caller')
var Rule = require('./rule')
const dynamicCaller = require('./dynamic-caller')
const Rule = require('./rule')

@@ -13,9 +13,9 @@ function Rules (chr) {

Rules.prototype.Add = function addRule (ruleObj, globalReplacements) {
var self = this
const self = this
var rule = new Rule(ruleObj, {
const rule = new Rule(ruleObj, {
replacements: globalReplacements,
scope: self._chr.Scope
})
var ruleName = rule.Name
const ruleName = rule.Name

@@ -29,3 +29,3 @@ if (typeof this[ruleName] !== 'undefined') {

var constraintName
let constraintName
ruleObj.constraints.forEach(function (functor) {

@@ -49,7 +49,7 @@ // add callers if not present

Rules.prototype.Reset = function reset () {
var self = this
var chr = this._chr
const self = this
const chr = this._chr
var constraintName
for (var functor in chr.Constraints) {
let constraintName
for (const functor in chr.Constraints) {
constraintName = functor.split('/')[0]

@@ -69,3 +69,3 @@ if (typeof chr[constraintName] !== 'undefined') {

Rules.prototype.ForEach = function forEach (callback, thisArg) {
var self = this
const self = this

@@ -72,0 +72,0 @@ this.Order.forEach(function (ruleName) {

module.exports = Store
var util = require('util')
var events = require('events')
const util = require('util')
const events = require('events')
var Table = require('easy-table')
const Table = require('easy-table')

@@ -34,3 +34,3 @@ function Store () {

Store.prototype.store = Store.prototype.add = function add (constraint) {
var id = this._getNewConstraintId()
const id = this._getNewConstraintId()
constraint.id = id

@@ -47,3 +47,3 @@ this._store[id] = constraint

Store.prototype.kill = function kill (id) {
var constraint = this._store[id]
const constraint = this._store[id]
if (!constraint) {

@@ -67,3 +67,3 @@ return

Store.prototype._addToIndex = function _addToIndex (constraint) {
var index = this._index
const index = this._index
if (typeof index[constraint.name] === 'undefined') {

@@ -96,3 +96,3 @@ index[constraint.name] = {}

Store.prototype.lookup = function lookup (name, arity) {
var index = this._index
const index = this._index

@@ -113,3 +113,3 @@ if (typeof index[name] !== 'undefined' &&

Store.prototype.forEach = function (cb) {
for (var id in this._store) {
for (const id in this._store) {
cb(this._store[id], id)

@@ -120,4 +120,4 @@ }

Store.prototype.map = function (callback, thisArg) {
var res = []
for (var id in this._store) {
const res = []
for (const id in this._store) {
res.push(callback.call(thisArg, this._store[id], id, this))

@@ -133,3 +133,3 @@ }

var t = new Table()
const t = new Table()

@@ -136,0 +136,0 @@ this.forEach(function (constraint) {

@@ -1,6 +0,6 @@

var test = require('tape')
const test = require('tape')
var dist = require('../../dist/chr')
var distWithoutParser = require('../../dist/chr-wop.min.js')
var version = require('../../package.json').version
const dist = require('../../dist/chr')
const distWithoutParser = require('../../dist/chr-wop.min.js')
const version = require('../../package.json').version

@@ -7,0 +7,0 @@ ;[dist, distWithoutParser].forEach(function (CHR) {

@@ -1,7 +0,7 @@

var test = require('tape')
const test = require('tape')
var CHR = require('../../src/index')
const CHR = require('../../src/index')
test('String arguments (Issue #20)', function (t) {
var chr = new CHR()
const chr = new CHR()
chr("a('p') ==> b")

@@ -21,3 +21,3 @@

test('String arguments (Issue #20), with Int value', function (t) {
var chr = new CHR()
const chr = new CHR()
chr("a('42') ==> b")

@@ -37,3 +37,3 @@

test('Int arguments', function (t) {
var chr = new CHR()
const chr = new CHR()
chr('a(42) ==> b')

@@ -57,3 +57,3 @@

test('Check String argument in guard', function (t) {
var chr = new CHR()
const chr = new CHR()
chr("a(X) ==> X === 'p' | b")

@@ -73,3 +73,3 @@

test('Check String argument in guard, with Int value', function (t) {
var chr = new CHR()
const chr = new CHR()
chr("a(X) ==> X === '42' | b")

@@ -76,0 +76,0 @@

@@ -1,7 +0,7 @@

var test = require('tape')
const test = require('tape')
var CHR = require('../../src/index')
const CHR = require('../../src/index')
test('null as argument in caller (Issue #28)', function (t) {
var chr = new CHR()
const chr = new CHR()
chr('a(null) ==> b')

@@ -21,3 +21,3 @@

test('null as argument in result (Issue #28)', function (t) {
var chr = new CHR()
const chr = new CHR()
chr('a ==> b(null)')

@@ -33,3 +33,3 @@

test('null as argument (Issue #28)', function (t) {
var chr = new CHR()
const chr = new CHR()
chr('a(null) ==> b(null)')

@@ -36,0 +36,0 @@

@@ -1,11 +0,11 @@

var test = require('tape')
const test = require('tape')
var CHR = require('../../src/index')
const CHR = require('../../src/index')
test('Rule.Brekpoints.onTry', function (t) {
t.test('single, simple rule', function (t) {
var chr = new CHR()
const chr = new CHR()
chr('r1 @ a ==> b')
var called = false
let called = false

@@ -27,6 +27,6 @@ chr.Rules.r1.Breakpoints.onTry = function (data, callback) {

t.test('given data', function (t) {
var chr = new CHR()
const chr = new CHR()
chr('r1 @ a ==> b')
var data
let data

@@ -48,3 +48,3 @@ chr.Rules.r1.Breakpoints.onTry = function (d, callback) {

t.test('multiple Rules', function (t) {
var chr = new CHR()
const chr = new CHR()
chr('r1 @ a ==> b')

@@ -54,4 +54,4 @@ chr('r2 @ a ==> c')

var called = []
var expected = ['r1', 'r2', 'r3']
const called = []
const expected = ['r1', 'r2', 'r3']

@@ -81,6 +81,6 @@ chr.Rules.r1.Breakpoints.onTry = function (data, callback) {

t.test('via chr.Rules.setBreakpoints()', function (t) {
var chr = new CHR()
const chr = new CHR()
chr('r1 @ a ==> b')
var called = false
let called = false

@@ -87,0 +87,0 @@ chr.Rules.SetBreakpoints(function (data, callback) {

@@ -1,7 +0,7 @@

var test = require('tape')
const test = require('tape')
var CHR = require('../../src/index')
const CHR = require('../../src/index')
test('chr.Store', function (t) {
var chr = new CHR()
const chr = new CHR()

@@ -14,3 +14,3 @@ t.equal(typeof chr.Store, 'object', 'chr.Store is object')

test('chr.History', function (t) {
var chr = new CHR()
const chr = new CHR()

@@ -23,3 +23,3 @@ t.equal(typeof chr.History, 'object', 'chr.History is object')

test('chr.Rules', function (t) {
var chr = new CHR()
const chr = new CHR()

@@ -33,3 +33,3 @@ t.equal(typeof chr.Rules, 'object', 'chr.Rules is object')

t.test('chr.Constraints is object', function (t) {
var chr = new CHR()
const chr = new CHR()

@@ -42,3 +42,3 @@ t.equal(typeof chr.Constraints, 'object')

t.test('chr.Constraints saves defined constraints and their occurences', function (t) {
var chr = new CHR()
const chr = new CHR()

@@ -66,3 +66,3 @@ t.deepEqual(chr.Constraints, {}, 'chr.Constraints is initially empty')

t.test('CHR instance is a function', function (t) {
var chr = new CHR()
const chr = new CHR()

@@ -75,3 +75,3 @@ t.equal(typeof chr, 'function', 'CHR instance is a function')

t.test('chr() adds callers for constraints', function (t) {
var chr = new CHR()
const chr = new CHR()

@@ -78,0 +78,0 @@ chr('a, b ==> c')

@@ -1,7 +0,7 @@

var test = require('tape')
const test = require('tape')
var CHR = require('../../src/index')
const CHR = require('../../src/index')
test('a ==> 1 < 2 | b', function (t) {
var chr = new CHR()
const chr = new CHR()
chr('a ==> 1 < 2 | b')

@@ -16,3 +16,3 @@

test('a ==> 1 > 2 | b', function (t) {
var chr = new CHR()
const chr = new CHR()
chr('a ==> 1 > 2 | b')

@@ -27,3 +27,3 @@

test('a ==> ${ () => 1 < 2 } | b', function (t) { // eslint-disable-line no-template-curly-in-string
var chr = new CHR()
const chr = new CHR()
chr('a ==>', function (cb) { cb(null, 1 < 2) }, '| b')

@@ -38,3 +38,3 @@

test('a ==> ${ () => 1 > 2 } | b', function (t) { // eslint-disable-line no-template-curly-in-string
var chr = new CHR()
const chr = new CHR()
chr('a ==>', function (cb) { cb(null, 1 > 2) }, '| b')

@@ -49,3 +49,3 @@

test('Scope', function (t) {
var chr = new CHR()
const chr = new CHR()
chr('a(N) ==>', function (N, cb) { cb(null, N > 10) }, '| b')

@@ -68,3 +68,3 @@

var chr = new CHR()
const chr = new CHR()
chr('a(N) ==>', greaterThan10, '| b')

@@ -71,0 +71,0 @@

@@ -1,7 +0,7 @@

var test = require('tape')
const test = require('tape')
var CHR = require('../../src/index')
const CHR = require('../../src/index')
test('a ==> b', function (t) {
var chr = new CHR()
const chr = new CHR()
chr('a ==> b')

@@ -16,3 +16,3 @@

test('a ==> b, c', function (t) {
var chr = new CHR()
const chr = new CHR()
chr('a ==> b, c')

@@ -27,3 +27,3 @@

test('a, b ==> c', function (t) {
var chr = new CHR()
const chr = new CHR()
chr('a, b ==> c')

@@ -46,3 +46,3 @@

test('a ==> b', function (t) {
var chr = new CHR()
const chr = new CHR()
chr('a ==> b')

@@ -60,3 +60,3 @@

test('a(N) ==> b(N+1,N+2)', function (t) {
var chr = new CHR()
const chr = new CHR()
chr('a(N) ==> b(N+1,N+2)')

@@ -74,3 +74,3 @@

test('a(N) ==> N <= 4 | a(N+1)', function (t) {
var chr = new CHR()
const chr = new CHR()
chr('a(N) ==> N <= 4 | a(N+1)')

@@ -85,3 +85,3 @@

test('a, a ==> b', function (t) {
var chr = new CHR()
const chr = new CHR()
chr('a, a ==> b')

@@ -96,3 +96,3 @@

test('a(0), b ==> c', function (t) {
var chr = new CHR()
const chr = new CHR()
chr('a(0), b ==> c')

@@ -99,0 +99,0 @@

@@ -1,7 +0,7 @@

var test = require('tape')
const test = require('tape')
var CHR = require('../../src/index')
const CHR = require('../../src/index')
test('a ==> ${ () => 1 < 2 } | b', function (t) { // eslint-disable-line no-template-curly-in-string
var chr = new CHR()
const chr = new CHR()
chr('a ==>', function (cb) { cb(null, 1 < 2) }, '| b')

@@ -16,3 +16,3 @@

test('a ==> ${ 1 < 2 } | b', function (t) { // eslint-disable-line no-template-curly-in-string
var chr = new CHR()
const chr = new CHR()
chr('a ==>', function (cb) { cb(null, 1 < 2) }, '| b')

@@ -27,3 +27,3 @@

test('a ==> ${ () => false } | b', function (t) { // eslint-disable-line no-template-curly-in-string
var chr = new CHR()
const chr = new CHR()
chr('a ==>', function (cb) { cb(null, false) }, '| b')

@@ -38,3 +38,3 @@

test('a ==> ${ () => fire("Rule fired") }', function (t) { // eslint-disable-line no-template-curly-in-string
var fired = false
let fired = false

@@ -46,3 +46,3 @@ function fire (string) {

var chr = new CHR()
const chr = new CHR()
chr('a ==>', function (cb) { fire('Rule fired'); cb() })

@@ -57,3 +57,3 @@

test('a ==> ${ fire }', function (t) { // eslint-disable-line no-template-curly-in-string
var fired = false
let fired = false
function fire (cb) {

@@ -64,3 +64,3 @@ fired = true

var chr = new CHR()
const chr = new CHR()
chr('a ==>', fire)

@@ -75,5 +75,5 @@

test('Scope', function (t) {
var i = 0
let i = 0
var chr = new CHR()
const chr = new CHR()
chr('a ==>', function (cb) { cb(null, i !== 0) }, '| b')

@@ -93,3 +93,3 @@

test('Replacement in String', function (t) {
var chr = new CHR()
const chr = new CHR()
chr('a ==>', function (cb) { cb(null, true) }, '| b')

@@ -109,3 +109,3 @@

var chr = new CHR()
const chr = new CHR()
chr('a(N) ==>', function (N, cb) { p(N); cb() })

@@ -119,3 +119,3 @@

t.test('a(N) ==> ${ (N) => p(N) }', function (t) { // eslint-disable-line no-template-curly-in-string
var n
let n

@@ -126,3 +126,3 @@ function p (k) {

var chr = new CHR()
const chr = new CHR()
chr('a(N) ==>', function (N, cb) { p(N); cb() })

@@ -137,3 +137,3 @@

t.test('a(N) ==> ${ p }', function (t) { // eslint-disable-line no-template-curly-in-string
var m
let m

@@ -145,3 +145,3 @@ function p (N, cb) {

var chr = new CHR()
const chr = new CHR()
chr('a(N) ==>', p)

@@ -148,0 +148,0 @@

@@ -1,9 +0,9 @@

var test = require('tape')
const test = require('tape')
var CHR = require('../../src/index')
const CHR = require('../../src/index')
test('chr.Rules.Add()', function (t) {
t.test('chr.Rules.Add() is a function', function (t) {
var chr = new CHR()
var rules = chr.Rules
const chr = new CHR()
const rules = chr.Rules

@@ -16,3 +16,3 @@ t.equal(typeof rules.Add, 'function', 'chr.Rules.Add() is a function')

t.test('chr.Rules.Add() gives rule name if not specified', function (t) {
var chr = new CHR()
const chr = new CHR()

@@ -23,3 +23,3 @@ chr('a ==> b')

var ruleName = chr.Rules.Order[0]
const ruleName = chr.Rules.Order[0]
t.ok(ruleName)

@@ -33,3 +33,3 @@ t.ok(chr.Rules[ruleName])

t.test('chr.Rules.Add() throws for identical rule name', function (t) {
var chr = new CHR()
const chr = new CHR()

@@ -49,4 +49,4 @@ chr('first @ a ==> b')

test('chr.Rules.Order', function (t) {
var chr = new CHR()
var rules = chr.Rules
const chr = new CHR()
const rules = chr.Rules

@@ -61,4 +61,4 @@ t.equal(typeof rules.Order, 'object', 'chr.Rules.Order is defined')

t.test('chr.Rules.ForEach() is a function', function (t) {
var chr = new CHR()
var rules = chr.Rules
const chr = new CHR()
const rules = chr.Rules

@@ -71,3 +71,3 @@ t.equal(typeof rules.ForEach, 'function', 'chr.Rules.ForEach() is a function')

t.test('chr.Rules.ForEach() loops through all rules', function (t) {
var chr = new CHR()
const chr = new CHR()

@@ -78,5 +78,5 @@ chr('first @ a ==> b')

var rules = chr.Rules
var found = {}
var order = []
const rules = chr.Rules
const found = {}
const order = []
rules.ForEach(function (rule) {

@@ -87,3 +87,3 @@ found[rule.Name] = 1

var expected = {
const expected = {
first: 1,

@@ -101,3 +101,3 @@ second: 1,

t.test('chr.Rules.ForEach() loops in order', function (t) {
var chr = new CHR()
const chr = new CHR()

@@ -108,4 +108,4 @@ chr('first @ a ==> b')

var rules = chr.Rules
var order = [
const rules = chr.Rules
const order = [
'third',

@@ -117,3 +117,3 @@ 'first',

var found = []
const found = []
rules.ForEach(function (rule) {

@@ -133,4 +133,4 @@ found.push(rule.Name)

t.test('chr.Rules.Reset() is a function', function (t) {
var chr = new CHR()
var rules = chr.Rules
const chr = new CHR()
const rules = chr.Rules

@@ -143,4 +143,4 @@ t.equal(typeof rules.Reset, 'function', 'chr.Rules.Reset() is a function')

t.test('chr.Rules.Reset() deletes existing rules', function (t) {
var chr = new CHR()
var rules = chr.Rules
const chr = new CHR()
const rules = chr.Rules

@@ -147,0 +147,0 @@ chr('first @ a ==> b')

@@ -1,7 +0,7 @@

var test = require('tape')
const test = require('tape')
var CHR = require('../../src/index')
const CHR = require('../../src/index')
test('a <=> b', function (t) {
var chr = new CHR()
const chr = new CHR()
chr('a <=> b')

@@ -16,3 +16,3 @@

test('a <=> true', function (t) {
var chr = new CHR()
const chr = new CHR()
chr('a <=> true')

@@ -27,3 +27,3 @@

test('a(0) <=> true', function (t) {
var chr = new CHR()
const chr = new CHR()
chr('a(0) <=> true')

@@ -38,3 +38,3 @@

test('a \\ b <=> true', function (t) {
var chr = new CHR()
const chr = new CHR()
chr('a \\ b <=> true')

@@ -41,0 +41,0 @@

@@ -1,9 +0,9 @@

var test = require('tape')
const test = require('tape')
var CHR = require('../../src/index')
const CHR = require('../../src/index')
test('Prevent MaxRange error for large recursions', function (t) {
var chr = new CHR()
const chr = new CHR()
var maxCall = 10000
const maxCall = 10000

@@ -10,0 +10,0 @@ chr('r1 @ a(N) ==> N > 0 | a(N-1)')

@@ -18,10 +18,10 @@ /**

var test = require('tape')
const test = require('tape')
var CHR = require('../../src/index')
const CHR = require('../../src/index')
test('string replacement in body', function (t) {
t.test('function reference', function (t) {
var scope = (function () {
var m
const scope = (function () {
let m

@@ -41,3 +41,3 @@ function fire (N, cb) {

var chr = new CHR({
const chr = new CHR({
scope: scope

@@ -56,4 +56,4 @@ })

t.test('indirection', function (t) {
var scope = (function () {
var m
const scope = (function () {
let m

@@ -78,3 +78,3 @@ function fire (N, cb) {

var chr = new CHR({
const chr = new CHR({
scope: scope

@@ -93,4 +93,4 @@ })

t.test('indirection via anonymous function', function (t) {
var scope = (function () {
var m
const scope = (function () {
let m

@@ -109,3 +109,3 @@ function fire (N) {

var chr = new CHR({
const chr = new CHR({
scope: scope

@@ -124,4 +124,4 @@ })

t.test('variable renaming', function (t) {
var scope = (function () {
var m
const scope = (function () {
let m

@@ -140,3 +140,3 @@ function fire (N) {

var chr = new CHR({
const chr = new CHR({
scope: scope

@@ -155,4 +155,4 @@ })

t.test('variable renaming with indirection', function (t) {
var scope = (function () {
var m
const scope = (function () {
let m

@@ -176,3 +176,3 @@ function fire (N) {

var chr = new CHR({
const chr = new CHR({
scope: scope

@@ -195,3 +195,3 @@ })

t.test('function reference, constant true', function (t) {
var scope = (function () {
const scope = (function () {
function test (cb) {

@@ -206,3 +206,3 @@ cb(null, true)

var chr = new CHR({
const chr = new CHR({
scope: scope

@@ -221,3 +221,3 @@ })

t.test('function reference, constant false', function (t) {
var scope = (function () {
const scope = (function () {
function test (cb) {

@@ -232,3 +232,3 @@ cb(null, false)

var chr = new CHR({
const chr = new CHR({
scope: scope

@@ -247,3 +247,3 @@ })

t.test('string replacement', function (t) {
var chr = new CHR()
const chr = new CHR()

@@ -264,5 +264,5 @@ // should be avoided; see note above

t.test('function reference', function (t) {
var m
let m
var replacements = (function () {
const replacements = (function () {
function fire (N, cb) { // eslint-disable-line no-unused-vars

@@ -280,3 +280,3 @@ m = N

var chr = new CHR()
const chr = new CHR()

@@ -293,5 +293,5 @@ // should be avoided; see note above

t.test('function', function (t) {
var m
let m
var replacements = (function () {
const replacements = (function () {
return [

@@ -304,3 +304,3 @@ 'function(N, cb) { t.equal(N, 42); m = N; cb() }'

var chr = new CHR()
const chr = new CHR()

@@ -307,0 +307,0 @@ // should be avoided; see note above

@@ -1,7 +0,7 @@

var test = require('tape')
const test = require('tape')
var joinParts = require('../src/join-parts')
const joinParts = require('../src/join-parts')
test('Single string', function (t) {
var res = joinParts([
const res = joinParts([
'a ==> b'

@@ -15,3 +15,3 @@ ])

test('Single replacement', function (t) {
var res = joinParts([
const res = joinParts([
'a ==>',

@@ -26,3 +26,3 @@ function () {}

test('Head ends with space', function (t) {
var res = joinParts([
const res = joinParts([
'a ==> ',

@@ -37,3 +37,3 @@ function () {}

test('Single replacement, ending with space', function (t) {
var res = joinParts([
const res = joinParts([
'a ==>',

@@ -49,3 +49,3 @@ function () {},

test('Multiple replacements, separated by comma', function (t) {
var res = joinParts([
const res = joinParts([
'a ==>',

@@ -62,3 +62,3 @@ function () {},

test('Multiple replacements, separated by comma, ending with empty space', function (t) {
var res = joinParts([
const res = joinParts([
'a ==>',

@@ -76,3 +76,3 @@ function () {},

test('Multiple replacements, without comma separation', function (t) {
var res = joinParts([
const res = joinParts([
'a ==>',

@@ -88,3 +88,3 @@ function () {},

test('Multiple replacements, without comma separation, ending with empty space', function (t) {
var res = joinParts([
const res = joinParts([
'a ==>',

@@ -101,3 +101,3 @@ function () {},

test('Mixed constraints and replacement comma sepator', function (t) {
var res = joinParts([
const res = joinParts([
'a ==> b,',

@@ -112,3 +112,3 @@ function () {}

test('Mixed constraints and replacement comma sepator, without comma', function (t) {
var res = joinParts([
const res = joinParts([
'a ==> b',

@@ -123,3 +123,3 @@ function () {}

test('Mixed constraints and replacement comma sepator, without comma, ending with constraint', function (t) {
var res = joinParts([
const res = joinParts([
'a ==> b',

@@ -135,3 +135,3 @@ function () {},

test('Constraint prefixed with comma', function (t) {
var res = joinParts([
const res = joinParts([
'a ==> b',

@@ -147,3 +147,3 @@ function () {},

test('Mixed constraints and replacement comma sepator, without comma, ending with multiple constraints', function (t) {
var res = joinParts([
const res = joinParts([
'a ==> b',

@@ -159,3 +159,3 @@ function () {},

test('Also works for simplification rule', function (t) {
var res = joinParts([
const res = joinParts([
'a <=> b',

@@ -171,3 +171,3 @@ function () {},

test('Function in guard', function (t) {
var res = joinParts([
const res = joinParts([
'a ==>',

@@ -184,3 +184,3 @@ function () {},

test('Mixed content in guard', function (t) {
var res = joinParts([
const res = joinParts([
'a ==>',

@@ -198,3 +198,3 @@ function () {},

test('Mixed content after guard', function (t) {
var res = joinParts([
const res = joinParts([
'a ==>',

@@ -201,0 +201,0 @@ function () {},

@@ -1,4 +0,4 @@

var test = require('tape')
const test = require('tape')
var parse = require('../parse')
const parse = require('../parse')

@@ -9,3 +9,3 @@ test('chr/parse', function (t) {

t.test('Parse program', function (t) {
var res = parse('a ==> b')
const res = parse('a ==> b')

@@ -19,3 +19,3 @@ t.equal(res.type, 'Program')

t.test('Parse element', function (t) {
var res = parse('a(3)', 'Constraint')
const res = parse('a(3)', 'Constraint')

@@ -34,7 +34,7 @@ t.equal(res.type, 'Constraint')

t.test('Parse Constraint', function (t) {
var parseConstraint = parse.element('Constraint')
const parseConstraint = parse.element('Constraint')
t.equal(typeof parseConstraint, 'function')
var res = parseConstraint('a(3)')
const res = parseConstraint('a(3)')
t.equal(res.type, 'Constraint')

@@ -41,0 +41,0 @@

@@ -1,7 +0,7 @@

var test = require('tape')
const test = require('tape')
var parse = require('../../parse').element('Body')
const parse = require('../../parse').element('Body')
test('b(N+1,N+2)', function (t) {
var res = parse('b(N+1,N+2)')
const res = parse('b(N+1,N+2)')

@@ -16,3 +16,3 @@ t.equal(typeof res, 'object')

test('b(N+1,N+2), c(N-1)', function (t) {
var res = parse('b(N+1,N+2), c(N-1)')
const res = parse('b(N+1,N+2), c(N-1)')

@@ -19,0 +19,0 @@ t.equal(typeof res, 'object')

@@ -1,7 +0,7 @@

var test = require('tape')
const test = require('tape')
var parse = require('../../parse').element('Constraint')
const parse = require('../../parse').element('Constraint')
test('a', function (t) {
var res = parse('a')
const res = parse('a')

@@ -17,3 +17,3 @@ t.equal(typeof res, 'object')

test('a(1)', function (t) {
var res = parse('a(1)')
const res = parse('a(1)')

@@ -30,3 +30,3 @@ t.equal(typeof res, 'object')

test('a(1,2)', function (t) {
var res = parse('a(1,2)')
const res = parse('a(1,2)')

@@ -39,3 +39,3 @@ t.equal(res.parameters.length, 2)

test('a(1, 2)', function (t) {
var res = parse('a(1, 2)')
const res = parse('a(1, 2)')

@@ -48,3 +48,3 @@ t.equal(res.parameters.length, 2)

test('a("1")', function (t) {
var res = parse('a("1")')
const res = parse('a("1")')

@@ -51,0 +51,0 @@ t.equal(res.parameters.length, 1)

@@ -1,7 +0,7 @@

var test = require('tape')
const test = require('tape')
var parse = require('../../parse').element('Constraints')
const parse = require('../../parse').element('Constraints')
test('a', function (t) {
var res = parse('a')
const res = parse('a')

@@ -17,3 +17,3 @@ t.equal(typeof res, 'object')

test('a,b', function (t) {
var res = parse('a,b')
const res = parse('a,b')

@@ -29,3 +29,3 @@ t.equal(typeof res, 'object')

test('a, b', function (t) {
var res = parse('a, b')
const res = parse('a, b')

@@ -41,3 +41,3 @@ t.equal(typeof res, 'object')

test('a(1,2), b', function (t) {
var res = parse('a(1,2), b')
const res = parse('a(1,2), b')

@@ -44,0 +44,0 @@ t.equal(typeof res, 'object')

@@ -1,7 +0,7 @@

var test = require('tape')
const test = require('tape')
var parse = require('../../parse').element('Guard')
const parse = require('../../parse').element('Guard')
test('X === 5 |', function (t) {
var res = parse('X === 5 |')
const res = parse('X === 5 |')

@@ -17,3 +17,3 @@ t.equal(typeof res, 'object')

test('X===5|', function (t) {
var res = parse('X===5|')
const res = parse('X===5|')

@@ -29,3 +29,3 @@ t.equal(typeof res, 'object')

test('true |', function (t) {
var res = parse('true |')
const res = parse('true |')

@@ -41,3 +41,3 @@ t.equal(typeof res, 'object')

test('f(X), g(Y) |', function (t) {
var res = parse('f(X), g(Y) |')
const res = parse('f(X), g(Y) |')

@@ -53,3 +53,3 @@ t.equal(typeof res, 'object')

test('f([1,2]), X = { a: 2, b: 4 } |', function (t) {
var res = parse('f([1,2]), X = { a: 2, b: 4 } |')
const res = parse('f([1,2]), X = { a: 2, b: 4 } |')

@@ -65,3 +65,3 @@ t.equal(typeof res, 'object')

test('${0}, ${1} |', function (t) { // eslint-disable-line no-template-curly-in-string
var res = parse('${0}, ${1} |') // eslint-disable-line no-template-curly-in-string
const res = parse('${0}, ${1} |') // eslint-disable-line no-template-curly-in-string

@@ -68,0 +68,0 @@ t.equal(typeof res, 'object')

@@ -1,7 +0,7 @@

var test = require('tape')
const test = require('tape')
var parse = require('../../parse').element('Parameter')
const parse = require('../../parse').element('Parameter')
test('1', function (t) {
var res = parse('1')
const res = parse('1')

@@ -16,3 +16,3 @@ t.equal(typeof res, 'object')

test('"1"', function (t) {
var res = parse('"1"')
const res = parse('"1"')

@@ -27,3 +27,3 @@ t.equal(typeof res, 'object')

test('[]', function (t) {
var res = parse('[]')
const res = parse('[]')

@@ -39,3 +39,3 @@ t.equal(typeof res, 'object')

test('{}', function (t) {
var res = parse('{}')
const res = parse('{}')

@@ -42,0 +42,0 @@ t.equal(typeof res, 'object')

@@ -1,7 +0,7 @@

var test = require('tape')
const test = require('tape')
var parse = require('../../parse').element('Program')
const parse = require('../../parse').element('Program')
test('Multiline program I', function (t) {
var res = parse([
const res = parse([
'name @ a ==> b',

@@ -19,3 +19,3 @@ 'name2 @ b <=> c'

test('Multiline program II', function (t) {
var res = parse([
const res = parse([
'',

@@ -34,3 +34,3 @@ 'name @ a ==> b',

test('Multiline program III', function (t) {
var res = parse([
const res = parse([
'',

@@ -50,3 +50,3 @@ 'name @ a ==> b',

test('Multiline program IV', function (t) {
var res = parse([
const res = parse([
'',

@@ -67,3 +67,3 @@ 'name @ a ==> b',

test('Multiline program V', function (t) {
var res = parse([
const res = parse([
'name @ a ==> b;',

@@ -70,0 +70,0 @@ 'name2 @ b <=> c;'

@@ -1,7 +0,7 @@

var test = require('tape')
const test = require('tape')
var parse = require('../../parse').element('PropagationRule')
const parse = require('../../parse').element('PropagationRule')
test('a ==> b', function (t) {
var res = parse('a ==> b')
const res = parse('a ==> b')

@@ -19,3 +19,3 @@ t.equal(typeof res, 'object')

test('a==>b', function (t) {
var res = parse('a==>b')
const res = parse('a==>b')

@@ -33,3 +33,3 @@ t.equal(typeof res, 'object')

test('a ==> b, c', function (t) {
var res = parse('a ==> b, c')
const res = parse('a ==> b, c')

@@ -44,3 +44,3 @@ t.equal(res.kept.length, 1)

test('a, b ==> c', function (t) {
var res = parse('a, b ==> c')
const res = parse('a, b ==> c')

@@ -55,3 +55,3 @@ t.equal(res.kept.length, 2)

test('a ==> X < 4 | c', function (t) {
var res = parse('a ==> X < 4 | c')
const res = parse('a ==> X < 4 | c')

@@ -68,3 +68,3 @@ t.equal(res.kept.length, 1)

test('a ==> X < 4, X > 0 | c', function (t) {
var res = parse('a ==> X < 4, X > 0 | c')
const res = parse('a ==> X < 4, X > 0 | c')

@@ -71,0 +71,0 @@ t.equal(res.kept.length, 1)

@@ -1,7 +0,7 @@

var test = require('tape')
const test = require('tape')
var parse = require('../../parse').element('Query')
const parse = require('../../parse').element('Query')
test('a', function (t) {
var res = parse('a')
const res = parse('a')

@@ -17,3 +17,3 @@ t.equal(typeof res, 'object')

test('a,b', function (t) {
var res = parse('a,b')
const res = parse('a,b')

@@ -29,3 +29,3 @@ t.equal(typeof res, 'object')

test('a b', function (t) {
var res = parse('a b')
const res = parse('a b')

@@ -41,3 +41,3 @@ t.equal(typeof res, 'object')

test(' a b ', function (t) {
var res = parse(' a b ')
const res = parse(' a b ')

@@ -53,3 +53,3 @@ t.equal(typeof res, 'object')

test('a, b', function (t) {
var res = parse('a, b')
const res = parse('a, b')

@@ -65,3 +65,3 @@ t.equal(typeof res, 'object')

test('a(1,2), b', function (t) {
var res = parse('a(1,2), b')
const res = parse('a(1,2), b')

@@ -77,3 +77,3 @@ t.equal(typeof res, 'object')

test('ab', function (t) {
var res = parse('ab')
const res = parse('ab')

@@ -89,3 +89,3 @@ t.equal(typeof res, 'object')

test('ab c ,d', function (t) {
var res = parse('ab c ,d')
const res = parse('ab c ,d')

@@ -101,3 +101,3 @@ t.equal(typeof res, 'object')

test('a,b,', function (t) {
var res = parse('a,b,')
const res = parse('a,b,')

@@ -118,3 +118,3 @@ t.equal(typeof res, 'object')

test('Array as argument', function (t) {
var res = parse('a([1,2,3])')
const res = parse('a([1,2,3])')

@@ -129,3 +129,3 @@ t.equal(typeof res, 'object')

test('Object as argument', function (t) {
var res = parse('a({ a: 1, b: 2, "c": 3 })')
const res = parse('a({ a: 1, b: 2, "c": 3 })')

@@ -140,3 +140,3 @@ t.equal(typeof res, 'object')

test('String as argument, single quotation marks', function (t) {
var res = parse("a('1,2,3')")
const res = parse("a('1,2,3')")

@@ -151,3 +151,3 @@ t.equal(typeof res, 'object')

test('String as argument, doule quotation marks', function (t) {
var res = parse('a("1,2,3")')
const res = parse('a("1,2,3")')

@@ -162,3 +162,3 @@ t.equal(typeof res, 'object')

test('Identifier as argument', function (t) {
var res = parse('a(fire)')
const res = parse('a(fire)')

@@ -173,3 +173,3 @@ t.equal(typeof res, 'object')

test('Function as argument', function (t) {
var res = parse('a(function() {})')
const res = parse('a(function() {})')

@@ -184,3 +184,3 @@ t.equal(typeof res, 'object')

test('Negative number as argument', function (t) {
var res = parse('a(-1)')
const res = parse('a(-1)')

@@ -187,0 +187,0 @@ t.equal(typeof res, 'object')

@@ -1,7 +0,7 @@

var test = require('tape')
const test = require('tape')
var parse = require('../../parse').element('Replacement')
const parse = require('../../parse').element('Replacement')
test('${0}', function (t) { // eslint-disable-line no-template-curly-in-string
var res = parse('${0}') // eslint-disable-line no-template-curly-in-string
const res = parse('${0}') // eslint-disable-line no-template-curly-in-string

@@ -16,3 +16,3 @@ t.equal(typeof res, 'object')

test('${42}', function (t) { // eslint-disable-line no-template-curly-in-string
var res = parse('${42}') // eslint-disable-line no-template-curly-in-string
const res = parse('${42}') // eslint-disable-line no-template-curly-in-string

@@ -19,0 +19,0 @@ t.equal(typeof res, 'object')

@@ -1,7 +0,7 @@

var test = require('tape')
const test = require('tape')
var parse = require('../../parse').element('Rule')
const parse = require('../../parse').element('Rule')
test('name @ a ==> b', function (t) {
var res = parse('name @ a ==> b')
const res = parse('name @ a ==> b')

@@ -16,3 +16,3 @@ t.equal(typeof res, 'object')

test('name @ a <=> b', function (t) {
var res = parse('name @ a <=> b')
const res = parse('name @ a <=> b')

@@ -27,3 +27,3 @@ t.equal(typeof res, 'object')

test('name @ a \\ b <=> c', function (t) {
var res = parse('name @ a \\ b <=> c')
const res = parse('name @ a \\ b <=> c')

@@ -38,3 +38,3 @@ t.equal(typeof res, 'object')

test('name @ a / b <=> c', function (t) {
var res = parse('name @ a / b <=> c')
const res = parse('name @ a / b <=> c')

@@ -49,3 +49,3 @@ t.equal(typeof res, 'object')

test('Set "constraints" property', function (t) {
var res = parse('name @ a ==> b')
const res = parse('name @ a ==> b')

@@ -52,0 +52,0 @@ t.ok(res.constraints)

@@ -1,7 +0,7 @@

var test = require('tape')
const test = require('tape')
var parse = require('../../parse').element('SimpagationRule')
const parse = require('../../parse').element('SimpagationRule')
test('a \\ b <=> c', function (t) {
var res = parse('a \\ b <=> c')
const res = parse('a \\ b <=> c')

@@ -19,3 +19,3 @@ t.equal(typeof res, 'object')

test('a \\ b, c <=> d', function (t) {
var res = parse('a \\ b, c <=> d')
const res = parse('a \\ b, c <=> d')

@@ -30,3 +30,3 @@ t.equal(res.kept.length, 1)

test('a, b \\ c <=> d', function (t) {
var res = parse('a, b \\ c <=> d')
const res = parse('a, b \\ c <=> d')

@@ -41,3 +41,3 @@ t.equal(res.kept.length, 2)

test('a \\ b <=> c, d', function (t) {
var res = parse('a \\ b <=> c, d')
const res = parse('a \\ b <=> c, d')

@@ -52,3 +52,3 @@ t.equal(res.kept.length, 1)

test('a \\ b <=> 3 < 4 | c', function (t) {
var res = parse('a \\ b <=> 3 < 4 | c')
const res = parse('a \\ b <=> 3 < 4 | c')

@@ -65,3 +65,3 @@ t.equal(res.kept.length, 1)

test('a \\ b <=> 3 < 4 | c', function (t) {
var res = parse('a \\ b <=> 3 < 4, 5 > 6 | c')
const res = parse('a \\ b <=> 3 < 4, 5 > 6 | c')

@@ -78,3 +78,3 @@ t.equal(res.kept.length, 1)

test('Simpagation with slash instead of backslash', function (t) {
var res = parse('a / b <=> c')
const res = parse('a / b <=> c')

@@ -81,0 +81,0 @@ t.equal(typeof res, 'object')

@@ -1,7 +0,7 @@

var test = require('tape')
const test = require('tape')
var parse = require('../../parse').element('SimplificationRule')
const parse = require('../../parse').element('SimplificationRule')
test('a <=> b', function (t) {
var res = parse('a <=> b')
const res = parse('a <=> b')

@@ -19,3 +19,3 @@ t.equal(typeof res, 'object')

test('a<=>b', function (t) {
var res = parse('a<=>b')
const res = parse('a<=>b')

@@ -33,3 +33,3 @@ t.equal(typeof res, 'object')

test('a <=> b, c', function (t) {
var res = parse('a <=> b, c')
const res = parse('a <=> b, c')

@@ -44,3 +44,3 @@ t.equal(res.kept.length, 0)

test('a, b <=> c', function (t) {
var res = parse('a, b <=> c')
const res = parse('a, b <=> c')

@@ -55,3 +55,3 @@ t.equal(res.kept.length, 0)

test('a <=> X < 4 | c', function (t) {
var res = parse('a <=> X < 4 | c')
const res = parse('a <=> X < 4 | c')

@@ -68,3 +68,3 @@ t.equal(res.kept.length, 0)

test('a <=> X < 4, X > 0 | c', function (t) {
var res = parse('a <=> X < 4, X > 0 | c')
const res = parse('a <=> X < 4, X > 0 | c')

@@ -71,0 +71,0 @@ t.equal(res.kept.length, 0)

@@ -1,8 +0,8 @@

var test = require('tape')
const test = require('tape')
var Constraint = require('../../src/constraint')
const Constraint = require('../../src/constraint')
test('Creation', function (t) {
t.test('Arity: 2', function (t) {
var c = new Constraint('con', 2, ['a', 'b'])
const c = new Constraint('con', 2, ['a', 'b'])

@@ -17,3 +17,3 @@ t.equal(c.name, 'con')

t.test('Arity: 0', function (t) {
var c = new Constraint('a', 0)
const c = new Constraint('a', 0)

@@ -32,3 +32,3 @@ t.equal(c.name, 'a')

t.test('Arity: 2', function (t) {
var c = new Constraint('con', 2, ['a', 'b'])
const c = new Constraint('con', 2, ['a', 'b'])

@@ -41,3 +41,3 @@ t.equal(c.toString(), 'con("a","b")')

t.test('Arity: 0', function (t) {
var c = new Constraint('con', 0)
const c = new Constraint('con', 0)

@@ -44,0 +44,0 @@ t.equal(c.toString(), 'con')

@@ -1,4 +0,4 @@

var test = require('tape')
const test = require('tape')
var Helper = require('../../runtime').Helper
const Helper = require('../../runtime').Helper

@@ -24,5 +24,5 @@ test('Runtime.Helper.allDifferent', function (t) {

t.test('Single single-element array', function (t) {
var input = [['3']]
const input = [['3']]
var res = []
const res = []
Helper.forEach(input, function (ids, callback) {

@@ -39,4 +39,4 @@ res.push(ids)

t.test('Runtime.Helper.forEach([[3,1,4],[9],[5,6],[8,2,7]])', function (t) {
var input = [['3', '1', '4'], ['9'], ['5', '6'], ['8', '2', '7']]
var expected = [
const input = [['3', '1', '4'], ['9'], ['5', '6'], ['8', '2', '7']]
const expected = [
['3', '9', '5', '8'],

@@ -62,3 +62,3 @@ ['3', '9', '5', '2'],

var res = []
const res = []
Helper.forEach(input, function (ids, callback) {

@@ -75,4 +75,4 @@ res.push(ids)

t.test('Avoids duplicates', function (t) {
var input = [['3', '1', '4'], ['1'], ['5', '9'], ['2', '6', '5', '4']]
var expected = [
const input = [['3', '1', '4'], ['1'], ['5', '9'], ['2', '6', '5', '4']]
const expected = [
['3', '1', '5', '2'],

@@ -92,3 +92,3 @@ ['3', '1', '5', '6'],

var res = []
const res = []
Helper.forEach(input, function (ids, callback) {

@@ -105,8 +105,8 @@ res.push(ids)

t.test('Not for identical IDs I', function (t) {
var input = [['1'], ['1', '2']]
var expected = [
const input = [['1'], ['1', '2']]
const expected = [
['1', '2']
]
var res = []
const res = []
Helper.forEach(input, function (ids, callback) {

@@ -123,8 +123,8 @@ res.push(ids)

t.test('Not for identical IDs II', function (t) {
var input = [[1], ['1', '2']]
var expected = [
const input = [[1], ['1', '2']]
const expected = [
['1', '2']
]
var res = []
const res = []
Helper.forEach(input, function (ids, callback) {

@@ -141,4 +141,4 @@ res.push(ids)

t.test('No-op for empty sub-array', function (t) {
var input = [[1, 2], []]
var called = false
const input = [[1, 2], []]
let called = false

@@ -145,0 +145,0 @@ t.notOk(called, 'not yet called')

@@ -1,4 +0,4 @@

var test = require('tape')
const test = require('tape')
var Runtime = require('../../runtime')
const Runtime = require('../../runtime')

@@ -5,0 +5,0 @@ test('Runtime.Store', function (t) {

@@ -1,8 +0,8 @@

var test = require('tape')
const test = require('tape')
var Store = require('../../src/store')
var Constraint = require('../../src/constraint')
const Store = require('../../src/store')
const Constraint = require('../../src/constraint')
test('Creation', function (t) {
var s = new Store()
const s = new Store()

@@ -15,6 +15,6 @@ t.ok(s)

test('Add/Remove', function (t) {
var s = new Store()
var c = new Constraint('a', 0)
const s = new Store()
const c = new Constraint('a', 0)
var id = s.add(c)
const id = s.add(c)

@@ -31,4 +31,4 @@ t.ok(id !== undefined)

test('Event Listeners', function (t) {
var s = new Store()
var c = new Constraint('a', 0)
const s = new Store()
const c = new Constraint('a', 0)

@@ -46,3 +46,3 @@ s.on('add', function (constraint) {

test('Store.forEach()', function (t) {
var s = new Store()
const s = new Store()

@@ -55,5 +55,5 @@ t.equal(typeof s.forEach, 'function')

test('Store.map()', function (t) {
var s = new Store()
const s = new Store()
var expected = [
const expected = [
'a(1)',

@@ -71,3 +71,3 @@ 'b(2,3)',

var res = s.map(function (c) {
const res = s.map(function (c) {
return c.toString()

@@ -74,0 +74,0 @@ })

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc