RuleSet(title)

A collection of one or more modification rules

Constructor

new RuleSet(title)

Parameters:
Name Type Description
title string

title of this ruleset

Example
let rules = new RuleSet('My Rules');

Methods

add(rule)Rule

Adds an rule to this ruleset.
If the provided argument is a string, a new instance of Rule will be created with the string as its description.
If the provided argument is an instance of Rule, simply adds it to the collection

Parameters:
Name Type Description
rule

rule description or an instance of Rule

Returns:

added rule

Type:
Rule
Examples
let rule = rules.add('My 1st rule');
Adding a new rule with description
let rule = rules.add(new Rule('My 1st rule'));
Adding a rule instance

out()

Outputs JSON representation of the whole rule set to STDOUT

toJSON()object

Returns a plain object representation of this ruleset

Returns:

an object like: { title: ... , rules: ... }

Type:
object
Example
let rules = new RuleSet('My Rules');
let obj = rules.toJSON();
console.log( obj.title ); // 'My Rules'