Advanced Rule Mode: Javascript Rule Expression

edgeSuite utilizes AngularJS’s $parse to parse the JavaScript rules entered by users. The $parse expects AngularJS Expressions which have some notable restrictions on what can be entered:

A full documentation on AngularJS Expressions can be found here.

To help users to create more powerful expressions and workaround the above limitations, the following JavaScript libraries are accessible in the rule evaluation context:

Underscore.js #

Version: 1.8.3

Reference: _

Used for array based manipulations.

_.uniq(var1.split(':')).length > 4
_.reject(var2.split(':'), StringUtil.createFunction('return parseInt(num) % 2 === 0;', ['num']) ).length === 3

Underscore.string #

Version: 3.1.1

Reference: s

Used for string based manipulations.

s.reverse(var1) === 'esrever'
s.titleize(var2) === 'Title Abc World'


Version: 2.17.1

Reference: moment

Used for date/time related manipulations.


Javascript Math

Reference: Math

Math functions provide browser’s native JavaScript Engine.

Math.round(var1) > 3
Math.abs(var2) <= 56

Javascript Console

Reference: console

Used for testing purposes.  The rule will not match and should be placed as 1st rule if you want it to be run for every record.

console.log(s.reverse(var1) === 'esrever')


This is an internal library supplied by edgeSuite that mimics the browser’s native JavaScript Engine string methods to work around the AngularJS Expression limitations stated above:

search(subjectString: string, regExpString: string, regExpFlags?: string): number

match(subjectString: string, regExpString: string, regExpFlags?: string): Array<string>

replace(subjectString: string, replaceString: string, regExpString: string, regExpFlags?: string): string

createRegExp(regExpString: string, regExpFlags?: string): RegExp

createFunction(functionBody: string, argumentList?: Array<string>): Function'^parent 001''i')) > -1
_.reject(var2.split(':'), StringUtil.createFunction('return parseInt(num) % 2 === 0;', ['num']) ).length === 3
StringUtil.match(var3, "\\d").index === 7
StringUtil.replace(var4, "$1-child""^(parent)") === 'parent-child 1'