_.every(TIME_SCALES, (timeScale, index, timeScales) => { const timeElement = { units: timeScale.units,
var validatorName = argumentsArray[1]; return _.every(param, function (item) { var validatorOptions = _.tail(argumentsArray); validatorOptions.unshift(item);
const haveFoundEverything = (lut) => { const values = Object.values(lut); if (values.length === 0) return false; return _.every(values); }
(function p(x) { if (_.isArray(x)) _.each(x, p) else if (_.isObject(x) && _.every(x, i => i !== 'red')) _.forIn(x, p) else if (_.isNumber(x)) t += x return t })(JSON.parse(i))
t.test('passes if all versions are validated', (t) => { const checkSystem = setupChecker({ engines: { node: process.version.substring(1) // remove the 'v' } }); checkSystem().then((result) => { t.equal(result.message.type, 'success'); t.assert(_.every(result.packages, ['type', 'success'])); t.end(); }); });
describe('Test the withGen function', () => { it('should replace the generator', () => { const gen = () => testcheck.gen.intWithin(5, 7); const spec = s.withGen(s.intIn(0, 10), gen); expect(s.exercise(spec)).to.have.length(10) .to.satisfy(sample => _.every(sample, ([v]) => s.isIntInRange(5, 8, v))); }); });
it('should implement a generator', () => { expect(s.exercise(s.doubleIn())).to.have.length(10) .to.satisfy(sample => _.every(sample, ([v]) => isDouble(v))); });
function testEventArgs(log, args={}) { return _.every( _.map( // Args can be an array and this will work because event args can // be indexed by offset as well. _.keys(args), name => _.isNil(args[name]) || util.isSameValue(log.args[name], args[name]), ), ); }
function plus(spec) { return { op: 'plus', conform: values => (values.length > 0 && _.every(values, value => isValid(spec, value))) ? values : invalidString, unform: _.identity, gen: () => tcg.null.then(() => tcg.array(gen(spec), {size: _.random(1, 5)})), describe: () => [plus.name, ...describe([spec])], explain: function*(values, {via}) { yield* explainLength(values, via); yield* explainInvalid(values, spec, via); } }; }
addProduct (product) { if (!_.every(['name', 'link', 'price', 'variation'], _.partial(_.has, product))) { this.emit('error', 'Fields missing in ' + JSON.stringify(product)) return this } if (!this.doUrlMatch(product.link)) { this.emit('error', url.parse(product.link).hostname + ' mismatch ' + this.url) return this } this.products.push(product) debug('Product', product.name, 'added') this.emit('submit', product) return this /* for method chaining */ }
_.every(population, network => { // (+a === +a) "equal to self" check is ~4000% faster than regex return typeof network.score == 'number' || typeof network.score == 'string' && +network.score === +network.score })
function tuple(...predicates) { return { conform: values => (values.length === predicates.length && _.every(_.zip(predicates, values), _.spread(isValid))) ? values : invalidString, unform: _.identity, gen: () => tcg.array(_.map(predicates, gen)), describe: () => [tuple.name, ...describe(predicates)], explain: function*(values, {via}) { yield* explainPredicate(values, predicates, {via}); yield* explainInvalid(values, predicates, via); } }; }
_.every(array, (e) => e === 0);
it('should implement a generator', () => { expect(s.exercise('::even-strings')).to.have.length(10) .to.satisfy(sample => _.every(sample, ([v]) => isEven(v.length))); });
it('should implement a generator', () => { expect(s.exercise(s.collOf(isInteger))).to.have.length(10) .to.satisfy(sample => _.every(sample, ([v]) => _.isArray(v))); });