How to use the lodash.includes function in lodash

To help you get started, we’ve selected a few lodash examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github acacode / flamebird / server / taskfile.js View on Github external
        ({ task }) => _.includes(task, 'yarn') || _.includes(task, 'npm')
      ),
github Automattic / wp-calypso / client / blocks / app-banner / utils.js View on Github external
export function getCurrentSection( currentSection, isNotesOpen, currentRoute ) {
	if ( isNotesOpen ) {
		return NOTES;
	}

	if ( currentRoute && currentRoute.indexOf( '/stats/activity/' ) !== -1 ) {
		//don't show app banner in activity log
		return null;
	}

	if ( includes( ALLOWED_SECTIONS, currentSection ) ) {
		return currentSection;
	}

	return null;
}
github ecomfe / veui / packages / veui / src / components / Schedule.vue View on Github external
validator (value) {
        return includes(['inline', 'popup'], value)
      }
    },
github codejamninja / reactant / packages / web-isomorphic / src / storybook / webpack.config.js View on Github external
import path from 'path';
import pkgDir from 'pkg-dir';
import { createWebpackConfig } from '@reactant/cli/webpack';
import { rebuildConfig } from '@reactant/cli/config';

const rootPath = pkgDir.sync(process.cwd());
const mergeConfiguration = require(require.resolve('merge-configuration', {
  paths: [
    path.resolve(
      pkgDir.sync(process.cwd()),
      'node_modules/@reactant/web-isomorphic'
    )
  ]
})).default;
let debug = false;
if (_.includes(process.argv, '--verbose')) setLevel('verbose');
if (_.includes(process.argv, '--debug')) {
  setLevel('debug');
  debug = true;
}

module.exports = webpackConfig => {
  const { config, platform } = rebuildConfig({
    options: { platform: 'web', debug }
  });
  const { paths, babel, options } = config;
  webpackConfig = createWebpackConfig(config, { platform, webpackConfig });
  webpackConfig.resolve.extensions.unshift('.web.js');
  webpackConfig.externals = {
    ...webpackConfig.externals,
    child_process: {},
    deasync: {},
github jxm262 / xchange.js / lib / parsers.js View on Github external
return _.reduce(data, (accum, v, k) => {

        const toMerge = (_.includes(segments, k))
            ? { segments: { [k]: v } }
            : { queryStrings: mapQueryStrings(queryStrings, k, v) };


        return _.merge(accum, toMerge);

    }, {segments: {}, queryStrings: {} })
}
github pump-io / pump.io / lib / as2.js View on Github external
var objectTypeToMethod = function(objectType) {
    if (!objectType) {
        return "object";
    } else if (_.has(objectVocabMap, objectType)) {
        return objectVocabMap[objectType];
    } else if (_.includes(ActivityObject.objectTypes, objectType) &&
                _.has(as, objectType)) {
        return objectType;
    } else {
        return "object";
    }
};
github rob-white / vue-slimgrid / src / assets / js / plugins / slick.headerfilter.js View on Github external
function getAllFilterValues(data, column) {
    var seen = [];
    for (var i = 0; i < data.length; i++) {
      var item = data[i];

      if (item.hasOwnProperty('__group') || item.hasOwnProperty('__groupTotals')) {
        continue;
      }

      var value = item[column.field];
      

      if (!_.includes(seen, value)) {
        seen.push(value);
      }
    }

    return _.sortBy(seen, function(v) {
      return v;
    });
  }
github identity-com / credential-commons / src / isValidGlobalIdentifier.js View on Github external
if (splited.length !== 3) {
    throw new Error('Malformed Global Identifier');
  }

  if (!_.includes(validPrefixes, splited[0])) {
    throw new Error('Invalid Global Identifier Prefix');
  }

  switch (splited[0]) {
    case 'claim':
      if (!_.includes(validUCAIdentifiers, splited[1]) && !_.includes(validClaimIdentifiers, identifier)) {
        throw new Error(`${identifier} is not valid`);
      }
      return true;
    case 'credential':
      if (!_.includes(validVCIdentifiers, splited[1]) && !_.includes(validVCIdentifiers, identifier)) {
        throw new Error(`${identifier} is not valid`);
      }
      return true;
    default:
      return false;
  }
}
github 0xProject / 0x-monorepo / packages / website / ts / utils / translate.ts View on Github external
constructor(desiredLanguage?: Language) {
        if (desiredLanguage !== undefined) {
            this.setLanguage(desiredLanguage);
            return;
        }
        const browserLanguage = (window.navigator as any).userLanguage || window.navigator.language || 'en-US';
        let language = Language.English;
        if (_.includes(browserLanguage, 'es-')) {
            language = Language.Spanish;
        } else if (_.includes(browserLanguage, 'zh-')) {
            language = Language.Chinese;
        } else if (_.includes(browserLanguage, 'ko-')) {
            language = Language.Korean;
        } else if (_.includes(browserLanguage, 'ru-')) {
            language = Language.Russian;
        }
        this.setLanguage(language);
    }
    public getLanguage(): Language {