当前位置: 首页>>代码示例>>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;未经允许,请勿转载。