當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。