當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript lodash.omitBy函數代碼示例

本文整理匯總了TypeScript中lodash.omitBy函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript omitBy函數的具體用法?TypeScript omitBy怎麽用?TypeScript omitBy使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了omitBy函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: restoreModified

      [`${resource}Modified`]: async function restoreModified(message: any,
        ctx: any, config: any, eventName: string): Promise<any> {
        that.decodeBufferField(message, resource);
        await db.update(`${resource}s`, { id: message.id }, _.omitBy(message, _.isNil));

        return {};
      },
開發者ID:restorecommerce,項目名稱:chassis-srv,代碼行數:7,代碼來源:index.ts

示例2: payments

export function payments(state: PaymentsState = initialState, {type, payload}: Action): PaymentsState {
  switch (type) {

    case PatientActions.REMOVE_SUCCESS: {
      const data = _.omitBy(state.data, p => p.patient_id == payload) as PaymentData;
      const ids = _.values(data).map(data => data['id']);
      return { ...state, ids, data };
    }

    case PaymentsActions.EDIT_SUCCESS: {
      return { ...state, data: { ...state.data, [payload.id]: payload } };
    }

    case PaymentsActions.CREATE_SUCCESS: {
      const data = { ...state.data, [payload.id]: payload };
      const ids = [payload.id, ...state.ids];
      return { selected: payload.id, status: true, ids , data };
    }

    case PaymentsActions.REMOVE_SUCCESS: {
      const ids = state.ids.filter(ids => ids !== payload.id);
      const data = _.omit(state.data, payload.id) as PaymentData;
      return { ...state, ids, data };
    }

    case PaymentsActions.INIT_SUCCESS: {
      const ids = payload.map(data => data.id);
      const data = _.mapKeys(payload, 'id') as PaymentData;

      return { ...state, status: false, ids, data };
    }

    default: return state;
  }
};
開發者ID:jogboms,項目名稱:ClinicRegistry,代碼行數:35,代碼來源:payments.ts

示例3: findExamClashes

export function findExamClashes(modules: Module[], semester: Semester): ExamClashes {
  const groupedModules = groupBy(modules, (module) =>
    get(getModuleSemesterData(module, semester), 'examDate'),
  );
  delete groupedModules.undefined; // Remove modules without exams
  return omitBy(groupedModules, (mods) => mods.length === 1); // Remove non-clashing mods
}
開發者ID:nusmodifications,項目名稱:nusmods,代碼行數:7,代碼來源:timetables.ts

示例4: buildSaveObject

  buildSaveObject() {
    const obj = _.omitBy(this, (val, key) => {
      return _.startsWith(key, '$')
        || _.isNotWritable(this, key);
    });

    return obj;
  }
開發者ID:IdleLands,項目名稱:IdleLands,代碼行數:8,代碼來源:guild.ts

示例5: onSubmit

  onSubmit(params) {
    this.passwordConfirmation.updateValueAndValidity({});
    this.passwordConfirmation.markAsTouched();
    if (!this.myForm.valid) return;

    this.userService.updateMe(omitBy(params, isEmpty))
      .subscribe(() => {
        toastr.success('Successfully updated.');
      }, this.handleError);
  }
開發者ID:Angular-Reference,項目名稱:angular2-app,代碼行數:10,代碼來源:user-edit.component.ts

示例6: getSpecialStatString

 static getSpecialStatString(item) {
   const newItem = _.omitBy(item, (val, key) => {
     return _.includes(baseIgnores, key) || _.includes(key, 'Percent') || _.includes(key, 'item') || !_.isNumber(val) || key === 'vector' || _.includes(key, 'Req');
   });
   return _(newItem)
     .keys()
     .filter(key => newItem[key] !== 0)
     .map(key => `${key}(${newItem[key]})`)
     .join(' ');
 }
開發者ID:IdleLands,項目名稱:Play,代碼行數:10,代碼來源:iteminfo.ts

示例7: updateCommunity

 updateCommunity(community: noosfero.Community) {
     const headers = {
         'Content-Type': 'application/json'
     };
     const attributesToUpdate: any = {
         community: Object.assign({}, _.omitBy(_.pick(community, ['name', 'closed']), _.isNull))
     };
     const restRequest = this.getElement(community.id).customOperation("patch", null, null, headers, attributesToUpdate);
     return restRequest.toPromise().then(this.getHandleSuccessFunction());
 }
開發者ID:vfcosta,項目名稱:angular-theme,代碼行數:10,代碼來源:community.service.ts

示例8: getFilterUrl

export function getFilterUrl(ownProps: OwnProps, part: RawQuery) {
  const basePathName = ownProps.organization
    ? `/organizations/${ownProps.organization.key}/projects`
    : '/projects';
  const pathname = basePathName + (ownProps.isFavorite ? '/favorite' : '');
  const query: RawQuery = omitBy({ ...ownProps.query, ...part }, isNil);
  each(query, (value, key) => {
    if (Array.isArray(value)) {
      query[key] = value.join(',');
    }
  });
  return { pathname, query };
}
開發者ID:christophelevis,項目名稱:sonarqube,代碼行數:13,代碼來源:utils.ts

示例9: getStandaloneMainSections

export function getStandaloneMainSections(sysInfoData: T.SysInfoBase): T.SysInfoValueObject {
  return {
    ...getSystemData(sysInfoData),
    ...(omitBy(
      sysInfoData,
      (value, key) =>
        value == null ||
        [PLUGINS_FIELD, SETTINGS_FIELD, STATS_FIELD, SYSTEM_FIELD].includes(key) ||
        key.startsWith(CE_FIELD_PREFIX) ||
        key.startsWith(SEARCH_PREFIX) ||
        key.startsWith(WEB_PREFIX)
    ) as T.SysInfoValueObject)
  };
}
開發者ID:SonarSource,項目名稱:sonarqube,代碼行數:14,代碼來源:utils.ts

示例10: getStandaloneMainSections

export function getStandaloneMainSections(sysInfoData: SysInfo): SysValueObject {
  return {
    ...getSystemData(sysInfoData),
    ...(omitBy(
      sysInfoData,
      (value, key) =>
        value == null ||
        [PLUGINS_FIELD, SETTINGS_FIELD, 'Statistics', 'System'].includes(key) ||
        key.startsWith('Compute Engine') ||
        key.startsWith('Search') ||
        key.startsWith('Web')
    ) as SysValueObject)
  };
}
開發者ID:christophelevis,項目名稱:sonarqube,代碼行數:14,代碼來源:utils.ts


注:本文中的lodash.omitBy函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。