lib/patch-builder.js
function remove() {
  var select      = null;
  var cardinality = null;

  var argLen = arguments.length;
  for (var i=0; i < argLen; i++) {
    var arg = arguments[i];
    if (i === 0) {
      select = arg;
      continue;
    }
    if (cardinality === null && /^[?.*+]$/.test(arg)) {
      cardinality = arg;
      continue;
    }
    break;
  }

  if (select === null) {
    throw new Error('remove takes select and optional cardinality');
  }

  var operation = {
    select: select
  };
  if (cardinality !== null) {
    operation.cardinality = cardinality;
  }

  return {'delete': operation};
}
function remove() {
  var select      = null;
  var cardinality = null;

  var argLen = arguments.length;
  for (var i=0; i < argLen; i++) {
    var arg = arguments[i];
    if (i === 0) {
      select = arg;
      continue;
    }
    if (cardinality === null && /^[?.*+]$/.test(arg)) {
      cardinality = arg;
      continue;
    }
    break;
  }

  if (select === null) {
    throw new Error('remove takes select and optional cardinality');
  }

  var operation = {
    select: select
  };
  if (cardinality !== null) {
    operation.cardinality = cardinality;
  }

  return {'delete': operation};
}
function remove ( ) { var select = null ; var cardinality = null ; var argLen = arguments . length ; for ( var i = 0 ; i < argLen ; i ++ ) { var arg = arguments [ i ] ; if ( i === 0 ) { select = arg ; continue ; } if ( cardinality === null && / ^[?.*+]$ / . test ( arg ) ) { cardinality = arg ; continue ; } break ; } if ( select === null ) { throw new Error ( 'remove takes select and optional cardinality' ) ; } var operation = { select : select } ; if ( cardinality !== null ) { operation . cardinality = cardinality ; } return { 'delete' : operation } ; }
An operation as part of a document patch request.
@typedef {object} patchBuilder.PatchOperation
@since 1.0
 
Builds an operation to remove a JSON property or XML element or attribute.
@method
@since 1.0
@memberof patchBuilder#
@param {string}  select - the path to select the fragment to remove
@param {string}  [cardinality] - a specification from the ?|.|*|+
enumeration controlling whether the select path must match zero-or-one
fragment, exactly one fragment, any number of fragments (the default), or
one-or-more fragments.
@returns {patchBuilder.PatchOperation} a patch operation
An operation as part of a document patch request .