Skip to content

Immutable rules for Node.js Bot Platform, which is passed between all Clusters and Skills in the decision tree.

Notifications You must be signed in to change notification settings

evilai/nbp-rules

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rules

This is a library, that allows you to create immutable rules in your Node.js Bot Platform. It based on reflecti stores.

import createRules from 'nbp-rules';
const rules = createRules({
    anyKey: 'anyValue',
    deepObject: {
        key: 'value',
        arr: [
            'hi',
            'bye'
        ]
    },
    silent: false
});

rules.get('silent'); // false
rules.get('deepObject.arr[1]'); // bye

// You can't mutate it directly, only with help of actions.
rules.set({ silent: true });
rules.get('silent'); // true

// There is a separate action for silent triggering
rules.silent(true);
rules.get('silent'); // true
rules.silent(false);
rules.get('silent'); // false

// If you want to run a certain skill outside from current skill cluster, use this action
rules.addSkills('skillName1', 'skillName2');
// Or remove skills from cluster traverse
rules.removeSkills('skillName1', 'skillName2');

About

Immutable rules for Node.js Bot Platform, which is passed between all Clusters and Skills in the decision tree.

Resources

Stars

Watchers

Forks

Packages

No packages published