How to use the contains function from underscore

Find comprehensive JavaScript underscore.contains code examples handpicked from public code repositorys.

375
376
377
378
379
380
381
382
383
384
    if(_.contains(locations, 'provinces')) {
        locations = _.reject(locations, elem => elem === 'provinces').concat('province 1', 'province 2', 'province 3', 'province 4');
    }
}
try {
    var cards = this.filterCards(card => matchFunc(card.cardData) && (locations === 'any' || _.contains(locations, card.location)), side);
} catch(e) {
    throw new Error(`Name: ${name}, Locations: ${locations}. Error thrown: ${e}`);
}
return cards;
fork icon18
star icon17
watch icon0

839
840
841
842
843
844
845
846
847
848
formulaSymbols.forEach((symbol) => {
  switch(symbol) {
    case PLUS_SIGN: {
      tryToProcessOperand()
      if (!thisThrow.formulaParts.length
        || _.contains(
          _.values(FORMULA_PART_TYPES.operators),
          thisThrow.formulaParts[thisThrow.formulaParts.length - 1].type
        )
      ) {
fork icon2
star icon5
watch icon1

+ 7 other calls in file

387
388
389
390
391
392
393
394
395
396
  if (_.has(schema, 'values')) {
    return new Map(_parseSchema(schema.values, schema, namespace));
  } else {
    throw new InvalidSchemaError('map must specify "values" schema, got ' + JSON.stringify(schema));
  }
} else if (_.has(schema, 'type') && _.contains(AvroSpec.PrimitiveTypes, schema.type)) {
  return _parseNamedType(schema.type, namespace);
} else {
  throw new InvalidSchemaError('not yet implemented: ' + schema.type);
}
fork icon0
star icon1
watch icon1

3372
3373
3374
3375
3376
3377
3378
3379
3380
3381

if (funct["(global)"]) {
	global[t] = funct;
	if (_.has(implied, t)) {
		if (state.option.latedef) {
			if ((state.option.latedef === true && _.contains([funct[t], type], "unction")) ||
					!_.contains([funct[t], type], "unction")) {
				warning("W003", state.tokens.next, t);
			}
		}
fork icon0
star icon0
watch icon1

+ 5 other calls in file

154
155
156
157
158
159
160
161
162
163
164
    return false;
  }
  if (!caseSensitive) {
    value = value.toLowerCase();
  }
  return _.contains(_.values(constants), value) ? value : false;
};


/**
* Checks whether an account type string is valid.
fork icon0
star icon0
watch icon0