/** * Selector and options * (or a function returning those) */ search(...args) { let s; let o; // In case it's a function if (isFunction(args[0])) { const q = args[0].call(this._collection, this._collection) || {}; s = q.selector; o = q.options; } // In case it's not else { s = args[0]; o = args[1]; } // In case the selector is not an object, assume it's an _id if (!isObject(s)) { s = {_id: s}; } // Push selector if not empty if (isObject(s) && keys(s).length > 0) { this._selectors.push(s); } if (isObject(o)) { // Ignore fields delete o.fields; // Deep merge options deepMixIn(this._options, o); } // Chain return this; }
var chalk = require('chalk'); var fs = require('fs'); var _o = require('mout/object'); var _a = require('mout/array'); var _l = require('mout/lang'); var _s = require('mout/string'); var defaultConfig = require('../core/config'); var svmTypes = require('../core/svm-types'); var kernelTypes = require('../core/kernel-types'); var SVM = require('../core/svm'); var createError = require('../util/create-error'); var cli = require('../util/cli'); var read = require('../util/read-dataset'); var svmTypesString = _o.keys(svmTypes); var kernelTypesString = _o.keys(kernelTypes); function train(logger, options) { var config; if (!options.pathToDataset){ return Q.reject(createError('<dataset file> required', 'EINVARGUMENTS')); } var datasetPath = path.resolve(options.cwd || '.', options.pathToDataset); delete options.pathToDataset; var defaults = defaultConfig(); var interactive = _o.has(options, 'interactive') ? !!options.interactive: defaults.interactive; return checkFileExists(datasetPath) .then(function (exists) { if (!exists) {