lib/parse.js
function parse(op, target) {
  if (OPERATORS.indexOf(op.op) !== -1) {
    op = clone(op);
    if (op.from != null) {
      op.from = parsePointer(op.from);
    }
    if (op.path != null) {
      op.path = parsePointer(op.path);
    } else {
      throw new error.InvalidOperationError(op.op, 'Operation object must have a "path" member');
    }
    validatePath(op.from || op.path, target);
    return op;
  }
  throw new error.InvalidOperationError('Operation object "op" member must be one of ' + OPERATORS.join(', ') + ' ' + ('but got "' + op.op + '"'));
}
function parse(op, target) {
  if (OPERATORS.indexOf(op.op) !== -1) {
    op = clone(op);
    if (op.from != null) {
      op.from = parsePointer(op.from);
    }
    if (op.path != null) {
      op.path = parsePointer(op.path);
    } else {
      throw new error.InvalidOperationError(op.op, 'Operation object must have a "path" member');
    }
    validatePath(op.from || op.path, target);
    return op;
  }
  throw new error.InvalidOperationError('Operation object "op" member must be one of ' + OPERATORS.join(', ') + ' ' + ('but got "' + op.op + '"'));
}
function parse ( op , target ) { if ( OPERATORS . indexOf ( op . op ) !== - 1 ) { op = clone ( op ) ; if ( op . from != null ) { op . from = parsePointer ( op . from ) ; } if ( op . path != null ) { op . path = parsePointer ( op . path ) ; } else { throw new error . InvalidOperationError ( op . op , 'Operation object must have a "path" member' ) ; } validatePath ( op . from || op . path , target ) ; return op ; } throw new error . InvalidOperationError ( 'Operation object "op" member must be one of ' + OPERATORS . join ( ', ' ) + ' ' + ( 'but got "' + op . op + '"' ) ) ; }
Parse and validate the patch operation.

Converts `op.path` (and `op.from` if
available) to an array.

@param {object} op
@param {Immutable} target
@returns {object} op
Parse and validate the patch operation .