Tabnine Logo For Javascript
has
Code IndexAdd Tabnine to your IDE (free)

How to use
has
function
in
lodash

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

origin: service-bot/servicebot

Fetcher(`/api/v1/users/${self.props.uid}`).then(function (response) {
  if (!response.error) {
    if (has(response, 'references.funds[0]') && has(response, 'references.funds[0].source.card')) {
      let fund = get(response, 'references.funds[0]');
      let card = get(response, 'references.funds[0].source.card');
origin: erickjth/simple-command-bus

getHandlerForCommand(commandName) {
    if (isString(commandName) === false) {
      throw new InvalidCommandException();
    }

    const handlerName = commandName.replace('Command', 'Handler');

    if (has(this.handlers, handlerName) === false) {
      MissingHandlerException.forCommand(commandName);
    }

    return this.handlers[handlerName];
  }
origin: botmasterai/botmaster

__addProperty(path, nameForError, value) {
  if (!value) {
   throw new Error(`${nameForError} must have a value. Can't be ${value}`);
  } else if (has(this, path)) {
   throw new Error(`Can't add ${nameForError} to outgoingMessage that already has ${nameForError}`);
  }
  set(this, path, value);

  return this;
 }
origin: botmasterai/botmaster

__removeProperty(path, nameForError) {
  if (!has(this, path)) {
   throw new Error(`Can't remove ${nameForError} from outgoingMessage that doesn't have any ${nameForError}`);
  }
  unset(this, path);

  return this;
 }
origin: botmasterai/botmaster

__setupServer() {
  if (this.settings.server && this.settings.port) {
   throw new Error(
    'IncompatibleArgumentsError: Please specify only ' +
    'one of port and server');
  }
  if (this.settings.server) {
   this.server = this.settings.server;
  } else {
   const port = has(this, 'settings.port')
    ? this.settings.port
    : 3000;
   this.server = this.__listen(port);
  }
  this.__setupServersRequestListeners();
 }
origin: sounds-social/sounds-social

const collectionHasFields = fieldKeys =>
 every(option => every(field => has(field)(option))(fieldKeys))
origin: sudo-suhas/elastic-builder

/**
   * Allows you to set a field that will be highlighted. The field is
   * added to the current list of fields.
   *
   * @param {string} field A field name.
   * @returns {Highlight} returns `this` so that calls can be chained
   */
  field(field) {
    if (!isNil(field) && !has(this._fields, field)) {
      this._fields[field] = {};
    }

    return this;
  }
origin: sudo-suhas/elastic-builder

/**
   * Internal helper function for determining the aggregation name.
   *
   * @returns {string} Aggregation name
   * @private
   */
  _aggsName() {
    if (!isEmpty(this._name)) return this._name;

    if (has(this._aggsDef, 'field')) {
      return `agg_${this.aggType}_${this._aggsDef.field}`;
    }

    // At this point, it would be difficult to construct a unique
    // aggregation name. Error out.
    throw new Error('Aggregation name could not be determined');
  }
origin: mariobermudezjr/ecommerce-react-graphql-stripe

checkForNestedForm(props) {
  forEach(props.section, (input) => {
   if (input.type === 'enum') {
    forEach(input.items, (item) => {
     if (has(item, 'items')) {
      this.setState({ hasNestedInput: true, inputWithNestedForm: input.target, section: item.items });

      if (props.values[input.target] === item.value) {
       this.setState({ showNestedForm: true });
      } else {
       this.setState({ showNestedForm: false });
      }
     }
    });
   }
  });
 }
origin: manaflair/mylittledom

export function EasyComputedStyle(computed, base = Object.create(null)) {

  return new Proxy(base, {

    ownKeys(target) {

      return Reflect.ownKeys(styleProperties);

    },

    has(target, key) {

      return has(styleProperties, key);

    },

    get(target, key) {

      if (!has(styleProperties, key))
        throw new Error(`Failed to get a style property: '${key}' is not a valid style property name.`);

      return computed.get(key);

    }

  });

}
origin: manaflair/mylittledom

export function parsePropertyValue(propertyName, rawValue) {

  if (!has(styleProperties, propertyName))
    throw new Error(`Failed to parse a style property: '${propertyName}' is not a valid style property.`);

  let property = styleProperties[propertyName];

  if (isUndefined(property.parsers))
    throw new Error(`Failed to parse a style property: '${propertyName}' has no declared parser.`);

  if (rawValue === `inherit`)
    return StyleInherit.inherit;

  let styleValue = parseRawValue(rawValue, property.parsers);

  if (isUndefined(styleValue))
    throw new Error(`Failed to parse a style property: '${rawValue}' is not a valid value for property '${propertyName}'.`);

  return styleValue;

}
origin: sudo-suhas/elastic-builder

/**
   *
   * @private
   * @param {string} clauseType
   * @param {string|Object|Array} clauses
   */
  _setSearchClause(clauseType, clauses) {
    // Replace the field. Don't care about previous contents
    if (Array.isArray(clauses)) this._queryOpts[clauseType] = clauses;
    else if (!has(this._queryOpts, clauseType)) {
      // Keep the single `like` without array.
      this._queryOpts[clauseType] = clauses;
    } else {
      // Wrap the single `like` in an array
      if (!Array.isArray(this._queryOpts[clauseType])) {
        this._queryOpts[clauseType] = [this._queryOpts[clauseType]];
      }
      // Append to array
      this._queryOpts[clauseType].push(clauses);
    }
  }
origin: mariobermudezjr/ecommerce-react-graphql-stripe

function getDataFromConfigs(configs) {
 const data = {};

 forEach(configs.sections, (section) => {
  forEach(section.items, (item) => {
   data[item.target] = item.value;

   if (has(item, 'items')) {
    forEach(item.items, (itemValue) => {
     data[itemValue.target] = itemValue.value;
    });
   }
  });
 });

 if (configs.name === 'form.security.name' && includes(split(get(data, 'security.xframe.value'), ' '), 'ALLOW-FROM')) {
  const allowFromValue = split(get(data, 'security.xframe.value'), ' ')[0];
  const allowFromValueNested = split(get(data, 'security.xframe.value'), ' ')[1];
  data['security.xframe.value'] = allowFromValue;
  data['security.xframe.value.nested'] = allowFromValueNested;
 }
 return data;
}
origin: mariobermudezjr/ecommerce-react-graphql-stripe

props.listContent.attributes.filter(attr => has(attr.params, 'target'))
origin: sudo-suhas/elastic-builder

/**
   * Override default `toJSON` to return DSL representation of the geo shape
   * class instance.
   *
   * @override
   * @returns {Object} returns an Object which maps to the elasticsearch query DSL
   */
  toJSON() {
    if (!has(this._body, 'type') || !has(this._body, 'coordinates')) {
      throw new Error(
        'For all types, both the inner `type` and `coordinates` fields are required.'
      );
    }
    return this._body;
  }
lodash(npm)has

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

  • async
    Higher-order functions and common patterns for asynchronous code
  • semver
    The semantic version parser used by npm.
  • minimist
    parse argument options
  • mongodb
    The official MongoDB driver for Node.js
  • q
    A library for promises (CommonJS/Promises/A,B,D)
  • mkdirp
    Recursively mkdir, like `mkdir -p`
  • body-parser
    Node.js body parsing middleware
  • postcss
  • crypto
  • From CI to AI: The AI layer in your organization
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