How to use the lodash-es/get function in lodash-es

To help you get started, we’ve selected a few lodash-es 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 openfun / richie / src / frontend / js / data / organizations / reducer.ts View on Github external
export const organizations: Reducer = (
  state: OrganizationsState = initialState,
  action?:
    | ResourceAdd
    | ResourceListGetSuccess
    | { type: '' },
) => {
  if (!action) {
    return state;
  } // Compiler needs help

  // Discriminate resource related actions by resource name
  if (
    get(action, 'resourceName') &&
    get(action, 'resourceName') !== modelName.ORGANIZATIONS
  ) {
    return state;
  }

  return flow([partialRight(byId, action), partialRight(currentQuery, action)])(
    state,
    action,
  );
};
github ncform / ncform / packages / ncform-common / src / ncform-utils.js View on Github external
disabled: false,
          readonly: false,
          hidden: false,
          help: {
            show: false,
            content: ""
          },

          /* 渲染组件字段 */
          widget:
            fieldSchema.widget || getDefWidget(type),
          widgetConfig: {
            placeholder: _get(fieldSchema, "ui.placeholder", ""),
            disabled: _get(fieldSchema, "ui.disabled", false),
            readonly: _get(fieldSchema, "ui.readonly", false),
            hidden: _get(fieldSchema, "ui.hidden", false)
          }
        },

        rules: {}
      };

      if (fullFields.ui.widget === "input") {
        fullFields.ui.widgetConfig.type = getInputWidgetType(fullFields.type);
      }

      const result = extend(true, fullFields, fieldSchema);
      result.ui.widget = _kebabCase(result.ui.widget);
      return result;
    }
github ncform / ncform / packages / ncform-theme-elementui / src / components / control-comps / input.vue View on Github external
: res.data;
        });
      }
      this.$data.prependSelectVal = _get(
        this.value,
        _get(this.mergeConfig, "compound.prependSelect.modelField")
      );
      this.$watch("prependSelectVal", function() {
        let val = this._processModelVal();
        this.$emit("input", val);
      });
    }

    if (_get(this.mergeConfig, "compound.appendSelect")) {
      if (_get(this.mergeConfig, "compound.appendSelect.enumSource")) {
        this.$data.appendSelectOptions = _get(
          this.mergeConfig,
          "compound.appendSelect.enumSource"
        );
      } else {
        this.$http({
          url: _get(
            this.mergeConfig,
            "compound.appendSelect.enumSourceRemote.remoteUrl"
          )
        }).then(res => {
          this.$data.appendSelectOptions = this.mergeConfig.compound
            .appendSelect.enumSourceRemote.resField
            ? _get(
                res.data,
                this.mergeConfig.compound.appendSelect.enumSourceRemote
                  .resField
github baianat / vuse / src / section.js View on Github external
get (name) {
    const path = toPath(name);
    const prop = path.pop();
    path.shift();
    const obj = path.length === 0 ? this.data : getPath(this.data, path);

    return obj[prop];
  }
github ncform / ncform / packages / ncform-theme-elementui / src / components / control-comps / select.vue View on Github external
this.$http(options).then(res => {
        this.$data.options = this.mergeConfig.enumSourceRemote.resField
          ? _get(res.data, this.mergeConfig.enumSourceRemote.resField)
          : res.data;
        if (
          this.mergeConfig.enumSourceRemote.selectFirstItem &&
          this.$data.options.length > 0
        ) {
          this.$data.modelVal =
            this.$data.modelVal ||
            this.$data.options[0][this.mergeConfig.itemValueField];
        }

        this._keepSelectedItem();
      });
    },
github ncform / ncform / packages / ncform-common / src / ncform-utils.js View on Github external
if (ncformUtils.isNormalObjSchema(schema)) {
        Object.keys(schema.properties).forEach(key => {
          if (schema.properties && schema.properties[key]) {
            valToFirstLevelProperties(
              val[key],
              schema.properties[key],
              !parentPath ? key : `${parentPath}.${key}`
            );
          }
        });
      } else if (force || schema.value === undefined) {
        schema.value = !parentPath
          ? value
          : ncformUtils.priorityGetValue(
              "basic",
              _get(value, parentPath),
              schema.value,
              ncformUtils.smartAnalyze(schema.default),
              ncformUtils.getDefVal(schema.type)
            );
      }
    }
github iotaledger / industry-marketplace / YellowPages / client / src / utils / storage.js View on Github external
const itemsOfType = allItems.reduce((accumulator, item) => {
        try {
            const json = JSON.parse(item);
            const itemType = get(json, 'type');
            if (itemType && itemType === type) {
              accumulator.push(json);
            }
            return accumulator;
        } catch (e) {
            return accumulator;
        }
    }, []);
    return itemsOfType;
github iotaledger / industry-marketplace / YellowPages / client / src / components / RequestMap.js View on Github external
async newMessage(message) {
    const card = await prepareData(get(message, 'data'));
    await writeToStorage(card);
    await this.checkExpired();
  }
github cloudkeeper-io / cloudkeeper-ui / src / contexts / user.context.tsx View on Github external
useEffect(() => firebase.auth().onAuthStateChanged(async (newUser) => {
    if (get(newUser, 'isAnonymous')) {
      const { mockClient } = await import('../__mocks__/client')
      setClient(mockClient)
    } else {
      setClient(getApolloClient(async () => (newUser ? newUser!.getIdToken() : '')))
    }

    setUserLoaded(true)
    setUser(newUser!)
    if (newUser) {
      setUserId(newUser.uid)
    }
  }), [])
github popcodeorg / popcode / src / selectors / getCurrentCompiledProjectKey.js View on Github external
export default function getCurrentCompiledProjectKey(state) {
  return get(state.get('compiledProjects').last(), ['compiledProjectKey']);
}