当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript lodash.forOwn函数代码示例

本文整理汇总了TypeScript中lodash.forOwn函数的典型用法代码示例。如果您正苦于以下问题:TypeScript forOwn函数的具体用法?TypeScript forOwn怎么用?TypeScript forOwn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了forOwn函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: callback

 worker.addEventListener("message", ({data}) => {
     _.forOwn(callbacks, (callback, name) => {
         if (data.type == name) {
             callback(data.content)
         }
     })
 })
开发者ID:MahaKoala,项目名称:client,代码行数:7,代码来源:index.ts

示例2: switch

export const pricingServiceReducer = (state: PricingOperationsReducerState = {}, action): PricingOperationsReducerState => {

  const { type, payload } = action
  switch (type) {
    case ACTION_TYPES.SPOT_PRICES_UPDATE:

      const updatedPrices = keyBy(action.payload, 'symbol')
      const updatedPricesDataObj = {}

      _.forOwn(updatedPrices, (value, key) => {
        const prevItem = state[key] || {}
        const newItem:SpotPriceTick = { ...value }
        newItem.priceStale = false
        newItem.priceMovementType = getPriceMovementType(prevItem, newItem)
        updatedPricesDataObj[key] = newItem
      })

      return { ...state, ...updatedPricesDataObj }
    case ACTION_TYPES.PRICING_STALE:
      return {
        ...state,
        [payload.symbol]: {
          ...state[payload.symbol],
          priceStale: true,
          notification: buildNotification(null, stalePriceErrorMessage)
        }
      }
    default:
      return state
  }
}
开发者ID:carlosrfernandez,项目名称:ReactiveTraderCloud,代码行数:31,代码来源:pricingReducer.ts

示例3:

 _.forEach(result, (resource) => {
   _.forOwn(resource["metrics"], (id, name) => {
     if (re.test(name)) {
       metrics[id] = this._compute_label(user_label, resource, name, target.aggregator);
     }
   });
 });
开发者ID:sileht,项目名称:grafana-gnocchi-datasource,代码行数:7,代码来源:datasource.ts

示例4: it

    it('successful password update', co(function *isSuccessfulPasswordUpdate() {
      const oldPassword = 'oldPassword';
      const newPassword = 'newPassword';
      const otherPassword = 'otherPassword';

      nock(bgUrl)
      .post('/api/v1/user/encrypted')
      .reply(200, {
        keychains: {
          xpub1: bitgo.encrypt({ input: 'xprv1', password: oldPassword }),
          xpub2: bitgo.encrypt({ input: 'xprv2', password: otherPassword })
        },
        version: 1
      });

      const result = yield keychains.updatePassword({ oldPassword: oldPassword, newPassword: newPassword });
      _.forOwn(result.keychains, function(encryptedXprv, xpub) {
        xpub.should.startWith('xpub');
        try {
          const decryptedPrv = bitgo.decrypt({ input: encryptedXprv, password: newPassword });
          decryptedPrv.should.startWith('xprv');
        } catch (e) {
          // the decryption didn't work because of the wrong password, this is one of the keychains that didn't match
          // the old password
          e.message.should.startWith('password error');
        }
      });
      result.should.hasOwnProperty('version');
    }));
开发者ID:BitGo,项目名称:BitGoJS,代码行数:29,代码来源:keychains.ts

示例5: transform

 transform(iterable: any, args: any[]): any {
     let result = [];
     _.forOwn(iterable, (value, key) => {
          result.push({key: key, value: value, id: cuid() });
     });
     return result;
 }
开发者ID:asiddeen,项目名称:BiB,代码行数:7,代码来源:iterable.pipe.ts

示例6:

 _.forEach(groupPaths, (groupPath) => {
     badgesByGroup[groupPath] = [];
     _.forOwn(badges, (badge) => {
         if (_.includes(badge.groups, groupPath)) {
             badgesByGroup[groupPath].push(badge);
         }
     });
 });
开发者ID:Janaba,项目名称:adhocracy3,代码行数:8,代码来源:Badge.ts

示例7: getQueryStringPrams

    private getQueryStringPrams(settings: RequestSettings): HttpParams {
        let queryParams = new HttpParams();

        _.forOwn(settings.queryString.getParams(), (value: string, key: string) => {
            queryParams = queryParams.set(key, value);
        });
        return queryParams;
    }
开发者ID:grecosoft,项目名称:Sandbox,代码行数:8,代码来源:RequestClient.ts

示例8: objectToMap

function objectToMap(input: object): Map<string, object> {
  const result = new Map<string, object>();

  forOwn(input, (value, key) => {
    result.set(key, value);
  });

  return result;
}
开发者ID:lmeijvogel,项目名称:my_node_openzwave,代码行数:9,代码来源:Main.ts

示例9: buildLookupTable

  private buildLookupTable(periodStarts: object): Map<string, TimePeriod> {
    let result = new Map<string, TimePeriod>();

    forOwn(periodStarts, (value, key) => {
      result.set(key, value);
    });

    return result;
  }
开发者ID:lmeijvogel,项目名称:my_node_openzwave,代码行数:9,代码来源:TimeService.ts

示例10: replaceTemplateTokensWithValues

    private replaceTemplateTokensWithValues(urlTemplate: string, tokens: {[name: string]:any} ): string {
        
        forOwn(tokens, (value: any, key: string) => {
            urlTemplate = this.replaceRouteTokens(urlTemplate, key, value);
            urlTemplate = this.replaceRouteTokens(urlTemplate, lowerFirst(key), value);
        });

        return this.removeOptionalRouteTokens(urlTemplate);
    }
开发者ID:grecosoft,项目名称:NetFusion,代码行数:9,代码来源:ApiRequest.ts

示例11: forOwn

 return forOwn(groupsByProvider, (groupsByRegion: IRegions, provider: string) => {
   forOwn(groupsByRegion, (groups: IRegionAccount[]) => {
     groups.forEach((group: IRegionAccount) => {
       group.provider = provider;
       group.account = account;
     });
   });
   securityGroups.push({account, provider, securityGroups: groupsByProvider[provider]});
 });
开发者ID:jtk54,项目名称:deck,代码行数:9,代码来源:securityGroupReader.service.ts

示例12: forOwn

 return forOwn(groupsByProvider, (groupsByRegion, provider) => {
   forOwn(groupsByRegion, (groups: ISecurityGroup[]) => {
     groups.forEach((group) => {
       group.provider = provider;
       group.account = account;
     });
   });
   securityGroups.push({account, provider, securityGroups: groupsByProvider[provider]});
 });
开发者ID:jcwest,项目名称:deck,代码行数:9,代码来源:securityGroupReader.service.ts

示例13: function

    return function(items, checkModel) {
        const keyArr = [];
        _.forOwn(checkModel, (value, key) => {
            if (value) {
                keyArr.push(key);
            }
        });

        return _.filter(items, (item: any) => _.some(keyArr, key => key === item.OrderStatus));
    };
开发者ID:disco-funk,项目名称:ca-london-angular,代码行数:10,代码来源:literature-order-status.filter.ts

示例14: getOperatonFunctionName

export function getOperatonFunctionName(term: ParsedTerm): string {
    if (term.type !== 'function') {
        return null;
    }
    let result = null;
    _.forOwn(operationFunctions, (value, key) => {
        if (value === term.name) {
            result = key;
            return false;
        }
    });
    _.forOwn(singleArgOperationFunctions, (value, key) => {
        if (value === term.name) {
            result = key;
            return false;
        }
    });
    return result;
}
开发者ID:OyeBenny,项目名称:sarad,代码行数:19,代码来源:parser.ts

示例15: getLinks

    private getLinks(resource: IHalResource): Link[] {
        let links: Link[] = [];

        _.forOwn(resource._links, (link: Link, rel: string) => {
            link.rel = rel;
            links.push(link);
        });

        return links;
    }
开发者ID:grecosoft,项目名称:Sandbox,代码行数:10,代码来源:ResourceAppService.ts


注:本文中的lodash.forOwn函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。