How to use the lodash/get 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 iotaledger / trinity-wallet / src / shared / migrations.js View on Github external
getStoredState(config, (err, restoredState) => {
        state.dispatch(setAppVersions(versions));

        // Fresh install
        if (isEmpty(restoredState)) {
            return persistState(state, config, cb);
        }

        const { app } = state.getState();

        const restoredVersion = get(restoredState, 'app.versions.version');
        const restoredBuildNumber = get(restoredState, 'app.versions.buildNumber');

        const incomingVersion = get(app, 'versions.version');
        const incomingBuildNumber = get(app, 'versions.buildNumber');
        const hasAnUpdate = restoredVersion !== incomingVersion || restoredBuildNumber !== incomingBuildNumber;

        return hasAnUpdate ? purgeBeforePersist(restoredState, state, config, cb) : persistState(state, config, cb);
    });
github Talend / ui / packages / forms / src / UIForm-v3 / schema / internal / validation / pattern.js View on Github external
export default function patternRule(schema, t) {
	const pattern = get(schema, 'schema.pattern');
	if (pattern) {
		return {
			value: new RegExp(pattern),
			message: t('ERROR_STRING_PATTERN', {
				defaultValue: 'String does not match pattern: {{pattern}}',
				pattern,
			}),
		};
	}
	return null;
}
github madou / armory-app / src / features / Character / index.js View on Github external
render() {
        const {
          match: { params },
          character,
          title,
          alias,
        } = this.props;

        const { editing } = this.state;

        const editable = alias === params.alias;
        const characterTitle = get(title, 'name');
        const showPublic = get(character, 'authorization.showPublic');
        const guild = character && {
          name: character.guild_name,
          tag: character.guild_tag,
          id: character.guild,
        };

        return (
          <content type="characters" title="{`${params.character}"></content>
github ovh / manager / packages / manager / modules / sms / src / sms / phonebooks / telecom-sms-phonebooks.controller.js View on Github external
(id) =>
                this.api.sms.phonebookContact.getBatch({
                  serviceName: this.$stateParams.serviceName,
                  bookKey: get(phonebook, 'bookKey'),
                  id,
                }).$promise,
            ),
github jaegertracing / jaeger-ui / packages / jaeger-ui / src / reducers / embedded.tsx View on Github external
export default function embeddedConfig(state: EmbeddedState | undefined) {
  if (state === undefined) {
    const search = _get(window, 'location.search');
    return search ? getEmbeddedState(search) : null;
  }
  return state;
}
github fannypackui / fannypack / packages / fannypack / src / Markdown / Markdown.tsx View on Github external
}
  },
  em: {
    Component: Text,
    props: {
      use: 'em',
      ..._get(props, 'elementProps.em', {})
    }
  },
  a: {
    Component: Link,
    props: _get(props, 'elementProps.a', {})
  },
  blockquote: {
    Component: Blockquote,
    props: _get(props, 'elementProps.blockquote', {})
  },
  h1: {
    Component: Heading,
    props: {
      use: 'h1',
      ..._get(props, 'elementProps.h1', {})
    }
  },
  h2: {
    Component: Heading,
    props: {
      use: 'h2',
      ..._get(props, 'elementProps.h2', {})
    }
  },
  h3: {
github lemonCMS / redux-form-generator / src / FinalForm / Types / WrapListMulti.jsx View on Github external
radioButtonList(list) {
    const staticField = this.props.static || _get(this.props.field, 'static', false);

    let disabled = false;
    if (this.props.field &amp;&amp; this.props.field.disabled &amp;&amp; _isFunction(this.props.field.disabled)) {
      disabled = this.props.checkDisabled(this.props.field.disabled(), _get(this.props.field, 'parent'));
    }

    if (_get(this.props, 'field.single', false) === true) {
      return _map(list, (option, key) =&gt; {
        if (staticField === true) {
          return ({option.desc});
        }

        return (
github HIIT / dime-ui / app / components / EntityCard / index.js View on Github external
renderTitle = (entity) =&gt; {
    const title = entity.targettedResource ? get(entity, 'targettedResource.title') : entity.title;
    const type = get(entity, 'type', '');
    return (
      <a href="{entity.targettedResource">
        <span>
          {title || type.substring(type.indexOf('#') + 1, type.length || entity['@type'])}
        </span>
      </a>
    );
  }
  renderEntityCardHeader = (entity) =&gt;
github namshi / reconfig / reconfig.js View on Github external
get(path, parameters, fallbackValue) {
        if (!path) {
            return this._config;
        }

        let value = _get(this._config, path, fallbackValue);
        value = (parameters) ? this.resolve(value, parameters) : value;

        return (_isUndefined(value) || _isNull(value)) ? null : value;
    }
}