• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript lodash.forOwn函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: forOwn

    programmesConfiguration.forEach((programme, name) => {
      const values: Map<string, any> = new Map<string, any>();

      forOwn(programme["values"], (value, key) => {
        values.set(key, value);
      });

      const newProgramme = new Programme(name, programme["displayName"], values, lights);

      programmes.push(newProgramme);
    });
开发者ID:lmeijvogel,项目名称:my_node_openzwave,代码行数:11,代码来源:ProgrammeFactory.ts


示例17: toNestedMap

  private toNestedMap(input): Map<string, Transitions> {
    let result = new Map<string, Transitions>();

    forOwn(input, (transitionsInput, event) => {
      let transitions: Transitions = new Map(toPairs(transitionsInput));

      result.set(event, transitions);
    });

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


示例18: install

export function install(packages: StringMap, timeoutDuration = 0) {
    const args = ['install'];

    _.forOwn(packages, (version, pkgname) => {
        args.push(`${pkgname}@${version}`);
    });

    return helpers.getOutput('npm', args, {
        timeoutDuration, stdout: StdioPolicy.copy, stderr: StdioPolicy.inherit
    });
}
开发者ID:mutantcornholio,项目名称:veendor,代码行数:11,代码来源:npmWrapper.ts


示例19: forOwn

 forOwn(groupedByCategory, (categoryServerGroups, category) => {
   const groupedByCluster = groupBy(categoryServerGroups, 'cluster');
   forOwn(groupedByCluster, (clusterServerGroups, clusterName) => {
     const cluster: ICluster = {
       account: account,
       category: category,
       name: clusterName,
       serverGroups: clusterServerGroups,
       cloudProvider: clusterServerGroups[0].cloudProvider
     };
     this.addHealthCountsToCluster(cluster);
     clusters.push(cluster);
   });
 });
开发者ID:brujoand,项目名称:deck,代码行数:14,代码来源:cluster.service.ts


示例20:

 data.map((row) => {
   let step = row.step;
   // iterate over each event in values
   _.forOwn(row.values, (value: number, key: string) => {
     // if new type of event, create new obj for key
     if (!_.has(chartData, key)){
       chartData[key] = [key];
       chartData[key + '_x'] = [key + '_x'];
       xs[key] = key + '_x';
     }
     chartData[key].push(value);
     chartData[key + '_x'].push(step);
   });
 });
开发者ID:Islandman93,项目名称:NeuralNetLog,代码行数:14,代码来源:Events.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript lodash.fromPairs函数代码示例发布时间:2022-05-25
下一篇:
TypeScript lodash.forIn函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap