Tabnine Logo For Javascript
LoDashStatic.indexOf
Code IndexAdd Tabnine to your IDE (free)

How to use
indexOf
function
in
LoDashStatic

Best JavaScript code snippets using lodash.LoDashStatic.indexOf(Showing top 15 results out of 315)

origin: lando/lando

_(loadCacheFile(config.toolingRouter))
   .map(route => _.merge({}, route, {
    closeness: _.indexOf(pathsToRoot(), route.route),
   }))
   .filter(route => route.closeness !== -1)
   .orderBy('closeness')
   .thru(routes => routes[0])
   .value()
origin: lando/lando

_(applications)
 // Get the basics
 .map(app => _.merge({}, app, {
  application: true,
  appMountDir: getAppMount(app, appRoot, applicationFiles),
  closeness: _.indexOf(traverseUp(), getAppMount(app, appRoot, applicationFiles)),
  // @TODO: can we assume the 0? is this an index value?
  // @NOTE: probably not relevant until we officially support multiapp?
  hostname: `${app.name}.0`,
  sourceDir: _.has(app, 'source.root') ? path.join('/app', app.source.root) : '/app',
  webroot: utils.getDocRoot(app),
 }))
 // And the webPrefix
 .map(app => _.merge({}, app, {
  webPrefix: _.difference(app.appMountDir.split(path.sep), appRoot.split(path.sep)).join(path.sep),
 }))
 // Return
 .value()
origin: service-bot/servicebot

{roles.map((role)=>
  <td key={`role${role.id}-permission${permission.id}`} className={`role${role.id}-permission${permission.id}`}>
    {_.indexOf(this.getRolePermissions(role.id), permission.id) > -1 ?
      <RoleToggle role={role.id} permission={permission.id} onChange={this.handleTogglePermission} checked={true}/>:
      <RoleToggle role={role.id} permission={permission.id} onChange={this.handleTogglePermission} checked={false}/>
origin: vicanso/influxdb-nodejs

function isBoolean(v) {
 const arr = ['t', 'true', 'f', 'false'];
 return _.indexOf(arr, v.toLowerCase()) !== -1;
}
origin: apigee-127/sway

function getSchemaProperties (schema) {
 var properties = _.keys(schema.properties); // Start with the defined properties

 // Add properties defined in the parent
 _.forEach(schema.allOf, function (parent) {
  _.forEach(getSchemaProperties(parent), function (property) {
   if (_.indexOf(properties, property) === -1) {
    properties.push(property);
   }
  });
 });

 return properties;
}
origin: apigee-127/sway

_.forEach(apiDefinition.definitionFullyResolved.paths, function (pathDef, name) {
  var pPath = ['paths', name];

  _.forEach(pathDef.security, createSecurityProcessor(pPath.concat('security')));

  _.forEach(pathDef, function (operationDef, method) {
   // Do not process non-operations
   if (_.indexOf(supportedHttpMethods, method) === -1) {
    return;
   }

   _.forEach(operationDef.security,
        createSecurityProcessor(pPath.concat([method, 'security'])));
  });
 });
origin: piyush94/NodeApp

QUnit.test("#3711 - remove's `update` event returns multiple removed models", function(assert) {
  var model = new Backbone.Model({id: 1, title: 'First Post'});
  var model2 = new Backbone.Model({id: 2, title: 'Second Post'});
  var collection = new Backbone.Collection([model, model2]);
  collection.on('update', function(context, options) {
   var changed = options.changes;
   assert.deepEqual(changed.added, []);
   assert.deepEqual(changed.merged, []);
   assert.ok(changed.removed.length === 2);

   assert.ok(_.indexOf(changed.removed, model) > -1 && _.indexOf(changed.removed, model2) > -1);
  });
  collection.remove([model, model2]);
 });
origin: heroku/react-flux-starter

//var redisClient = redis.createClient(parsedUrl.port || 6379, parsedUrl.hostname || 'localhost');

 function unsubscribe(socket, channel) {
  console.log('unsubscribing from ' + channel);
  // Get listeners for channel.  Remove socket for list.  If
  // channel listeners becomes empty then unsubscribe from redis
  // channel and remove channel from internal subsciptions hash
  var channelListeners = _subscriptions[channel];
  if (channelListeners) {
   channelListeners.splice(_.indexOf(channelListeners, socket), 1);
   if (channelListeners.length === 0) {
    //redisClient.unsubscribe(channel);
    delete _subscriptions[channel];
   }
  }
 }
origin: apigee-127/sway

_.forEach(apiDefinition.definitionFullyResolved.securityDefinitions, function (def, name) {
  var sPath = ['securityDefinitions', name];

  referenceable.push(JsonRefs.pathToPtr(sPath));

  _.forEach(def.scopes, function (description, scope) {
   var ptr = JsonRefs.pathToPtr(sPath.concat(['scopes', scope]));

   if (_.indexOf(referenceable, ptr) === -1) {
    referenceable.push(ptr);
   }
  });
 });
origin: sasha7/notes-app

// Unlink OAuth provider
const unlinkProvider = (req, res, next) => {
 const provider = req.params.provider;
 const validProviders = ['facebook'];

 // check if provider is valid
 if (!_.isEmpty(provider) && _.indexOf(validProviders, provider) === -1) {
  req.flash('error', { msg: 'Invalid OAuth Provider' });
  return res.redirect('/profile');
 }

 const data = {};
 data[provider] = '';
 data.picture = '';

 User.query()
  .patchAndFetchById(req.user.id, data)
  .then((user) => {
   req.flash('success', { msg: `Your ${provider} account has been unlinked.` });
   return res.redirect('/profile');
  })
  .catch(next);
}
origin: apigee-127/sway

function addReference (ref, ptr) {
  if (_.indexOf(references, ref) === -1) {
   if (_.isUndefined(references[ref])) {
    references[ref] = [];
   }

   // Add references to ancestors
   if (ref.indexOf('allOf') > -1) {
    addReference(ref.substring(0, ref.lastIndexOf('/allOf')));
   }

   references[ref].push(ptr);
  }
 }
origin: mcpolandc/siteadmin

Dispatcher.register(function(action) {
  switch (action.actionType) {

    case ActionTypes.INITIALISE:
      _authors = action.initialData.authors;
      AuthorStore.emitChange();
      break;

    case ActionTypes.CREATE_AUTHOR:
      _authors.push(action.author);
      AuthorStore.emitChange();
      break;

    case ActionTypes.UPDATE_AUTHOR:
      var existingAuthor = _.find(_authors, {id: action.author.id});
      var existingAuthorIndex = _.indexOf(_authors, existingAuthor);
      _authors.splice(existingAuthorIndex, 1, action.author);
      AuthorStore.emitChange();
      break;

    default:
      //nothing
  }
});
origin: ruojs/ruo

validateContentType (contentType, supportedTypes) {
  const rawContentType = contentType

  if (!_.isUndefined(contentType)) {
   // http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17
   contentType = contentType.split(';')[0] // Strip the parameter(s) from the content type
  }

  // Check for exact match or mime-type only match
  if (_.indexOf(supportedTypes, rawContentType) === -1 && _.indexOf(supportedTypes, contentType) === -1) {
   return {
    code: 'INVALID_CONTENT_TYPE',
    message: 'Invalid Content-Type (' + contentType + ').  These are supported: ' +
    supportedTypes.join(', '),
    path: []
   }
  }
 }
origin: mariobermudezjr/ecommerce-react-graphql-stripe

_.forEach(apis, api => {
    const modelsPath = path.join(apiPath, api, 'models');

    let models;
    try {
     models = fs.readdirSync(modelsPath);

     const modelIndex = _.indexOf(_.map(models, model => _.toLower(model)), searchFileName);

     if (modelIndex !== -1) searchFilePath = `${modelsPath}/${models[modelIndex]}`;
    } catch (e) {
     errors.push({
      id: 'request.error.folder.read',
      params: {
       folderPath: modelsPath
      }
     });
    }
   });
origin: vicanso/influxdb-nodejs

/**
  * Get the reader options
  * @param  {String} key - The key of options
  * @return {Any}
  * @since 2.2.0
  * @example
  * const reader = client.query('http').set({
  *   limit: 10,
  * });
  * console.info(reader.get('limit'));
  * // => 10
  */
 get(k) {
  if (_.indexOf(qlKeys, k) !== -1) {
   return this[k];
  }
  return internal(this).options[k];
 }
lodash(npm)LoDashStaticindexOf

JSDoc

Gets the index at which the first occurrence of `value` is found in `array`
using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
for equality comparisons. If `fromIndex` is negative, it's used as the offset
from the end of `array`.

Most used lodash functions

  • LoDashStatic.map
    Creates an array of values by running each element in collection through iteratee. The iteratee is
  • LoDashStatic.isEmpty
    Checks if value is empty. A value is considered empty unless it’s an arguments object, array, string
  • LoDashStatic.forEach
    Iterates over elements of collection invoking iteratee for each element. The iteratee is invoked wit
  • LoDashStatic.find
    Iterates over elements of collection, returning the first element predicate returns truthy for.
  • LoDashStatic.pick
    Creates an object composed of the picked `object` properties.
  • LoDashStatic.get,
  • LoDashStatic.isArray,
  • LoDashStatic.filter,
  • LoDashStatic.merge,
  • LoDashStatic.isString,
  • LoDashStatic.isFunction,
  • LoDashStatic.assign,
  • LoDashStatic.extend,
  • LoDashStatic.includes,
  • LoDashStatic.keys,
  • LoDashStatic.cloneDeep,
  • LoDashStatic.uniq,
  • LoDashStatic.isObject,
  • LoDashStatic.omit

Popular in JavaScript

  • webpack
    Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.
  • moment
    Parse, validate, manipulate, and display dates
  • postcss
  • cheerio
    Tiny, fast, and elegant implementation of core jQuery designed specifically for the server
  • lodash
    Lodash modular utilities.
  • yargs
    yargs the modern, pirate-themed, successor to optimist.
  • node-fetch
    A light-weight module that brings window.fetch to node.js
  • redis
    Redis client library
  • ms
    Tiny millisecond conversion utility
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now