lib/query-builder.js
function extract() {
  var args = mlutil.asArray.apply(null, arguments);
  var argLen = args.length;
  if (argLen < 1) {
    throw new Error('must specify paths to extract');
  }

  var extractdef = {};

  var arg = args[0];
  if (typeof arg === 'string' || arg instanceof String) {
    extractdef['extract-path'] = args;
  } else {
    var paths = arg.paths;
    if (typeof paths === 'string' || paths instanceof String) {
      extractdef['extract-path'] = [paths];
    } else if (Array.isArray(paths)) {
      extractdef['extract-path'] = paths;
    } else if (paths === void 0) {
      throw new Error('first argument does not have key for paths to extract');
    }

    var namespaces = arg.namespaces;
    if (namespaces !== void 0) {
      extractdef.namespaces = namespaces;
    }

    var selected = arg.selected;
    if (selected !== void 0) {
      extractdef.selected = selected;
    }
  }

  return {'extract-document-data': extractdef};
}
function extract() {
  var args = mlutil.asArray.apply(null, arguments);
  var argLen = args.length;
  if (argLen < 1) {
    throw new Error('must specify paths to extract');
  }

  var extractdef = {};

  var arg = args[0];
  if (typeof arg === 'string' || arg instanceof String) {
    extractdef['extract-path'] = args;
  } else {
    var paths = arg.paths;
    if (typeof paths === 'string' || paths instanceof String) {
      extractdef['extract-path'] = [paths];
    } else if (Array.isArray(paths)) {
      extractdef['extract-path'] = paths;
    } else if (paths === void 0) {
      throw new Error('first argument does not have key for paths to extract');
    }

    var namespaces = arg.namespaces;
    if (namespaces !== void 0) {
      extractdef.namespaces = namespaces;
    }

    var selected = arg.selected;
    if (selected !== void 0) {
      extractdef.selected = selected;
    }
  }

  return {'extract-document-data': extractdef};
}
function extract ( ) { var args = mlutil . asArray . apply ( null , arguments ) ; var argLen = args . length ; if ( argLen < 1 ) { throw new Error ( 'must specify paths to extract' ) ; } var extractdef = { } ; var arg = args [ 0 ] ; if ( typeof arg === 'string' || arg instanceof String ) { extractdef [ 'extract-path' ] = args ; } else { var paths = arg . paths ; if ( typeof paths === 'string' || paths instanceof String ) { extractdef [ 'extract-path' ] = [ paths ] ; } else if ( Array . isArray ( paths ) ) { extractdef [ 'extract-path' ] = paths ; } else if ( paths === void 0 ) { throw new Error ( 'first argument does not have key for paths to extract' ) ; } var namespaces = arg . namespaces ; if ( namespaces !== void 0 ) { extractdef . namespaces = namespaces ; } var selected = arg . selected ; if ( selected !== void 0 ) { extractdef . selected = selected ; } } return { 'extract-document-data' : extractdef } ; }
Specifies JSON properties or XML elements to project from the
documents returned by a query.
@method
@since 1.0
@memberof queryBuilder#
@param {string|string[]} paths - restricted XPaths (valid for
the cts:valid-index-path() function) to match in documents
@param {object} [namespaces] - for XPaths using namespaces,
an object whose properties specify the prefix as the key and
the uri as the value
@param {string} [selected] - specifies how to process
the selected JSON properties or XML elements where
include (the default) lists the selections,
include-ancestors projects a sparse document with
the selections and their ancesors, and
exclude suppresses the selections to projects a sparse document
with the sibilings and ancestors of the selections.
@returns {object} a extract definition
for the {@link queryBuilder#slice} function
Specifies JSON properties or XML elements to project from the documents returned by a query .