lib/jsonscript.js
function addInstruction(definition, keywordFunc, _regenerateSchemas) {
  var valid = this._validateInstruction(definition);
  if (!valid) throw new Ajv.ValidationError(this._validateInstruction.errors);
  // TODO check instruction is unique
  this._instructions.push(definition);
  var keyword = definition.evaluate.validatorKeyword;
  this._evalKeywords[keyword] = keywordFunc;
  addAjvKeyword.call(this, keyword, 'object', true);
  if (_regenerateSchemas !== false) generateSchemas();
}
function addInstruction(definition, keywordFunc, _regenerateSchemas) {
  var valid = this._validateInstruction(definition);
  if (!valid) throw new Ajv.ValidationError(this._validateInstruction.errors);
  // TODO check instruction is unique
  this._instructions.push(definition);
  var keyword = definition.evaluate.validatorKeyword;
  this._evalKeywords[keyword] = keywordFunc;
  addAjvKeyword.call(this, keyword, 'object', true);
  if (_regenerateSchemas !== false) generateSchemas();
}
function addInstruction ( definition , keywordFunc , _regenerateSchemas ) { var valid = this . _validateInstruction ( definition ) ; if ( ! valid ) throw new Ajv . ValidationError ( this . _validateInstruction . errors ) ; // TODO check instruction is unique this . _instructions . push ( definition ) ; var keyword = definition . evaluate . validatorKeyword ; this . _evalKeywords [ keyword ] = keywordFunc ; addAjvKeyword . call ( this , keyword , 'object' , true ) ; if ( _regenerateSchemas !== false ) generateSchemas ( ) ; }
add JSONScript instruction to the interpreter
@this  JSONScript
@param {Object}   definition         instruction definition, should be valid according to the schema http://www.jsonscript.org/schema/instruction.json#
@param {Function} keywordFunc        function to implement the instruction, accepts instruction object and dataPath as parameter, should return sync/async value or Script instance
@param {Boolean}  _regenerateSchemas pass false to prevent regenerating the schemas, can be used when multiple instructions are added
add JSONScript instruction to the interpreter