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

TypeScript lang.NumberWrapper类代码示例

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

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



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

示例1: _format

 static _format(value: number, style: NumberFormatStyle, digits: string, currency: string = null,
                currencyAsSymbol: boolean = false): string {
   if (isBlank(value)) return null;
   if (!isNumber(value)) {
     throw new InvalidPipeArgumentException(NumberPipe, value);
   }
   var minInt = 1, minFraction = 0, maxFraction = 3;
   if (isPresent(digits)) {
     var parts = RegExpWrapper.firstMatch(_re, digits);
     if (isBlank(parts)) {
       throw new BaseException(`${digits} is not a valid digit info for number pipes`);
     }
     if (isPresent(parts[1])) {  // min integer digits
       minInt = NumberWrapper.parseIntAutoRadix(parts[1]);
     }
     if (isPresent(parts[3])) {  // min fraction digits
       minFraction = NumberWrapper.parseIntAutoRadix(parts[3]);
     }
     if (isPresent(parts[5])) {  // max fraction digits
       maxFraction = NumberWrapper.parseIntAutoRadix(parts[5]);
     }
   }
   return NumberFormatter.format(value, defaultLocale, style, {
     minimumIntegerDigits: minInt,
     minimumFractionDigits: minFraction,
     maximumFractionDigits: maxFraction,
     currency: currency,
     currencyAsSymbol: currencyAsSymbol
   });
 }
开发者ID:beta3000,项目名称:hola-angular2,代码行数:30,代码来源:number_pipe.ts


示例2:

 this._printStringRow(this._metricNames.map(metricName => {
   var samples = validSamples.map(measureValues => measureValues.values[metricName]);
   var mean = Statistic.calculateMean(samples);
   var cv = Statistic.calculateCoefficientOfVariation(samples, mean);
   var formattedMean = ConsoleReporter._formatNum(mean)
                           // Note: Don't use the unicode character for +- as it might cause
                           // hickups for consoles...
                           return NumberWrapper.isNaN(cv) ?
                           formattedMean :
                           `${formattedMean}+-${Math.floor(cv)}%`;
 }));
开发者ID:hankduan,项目名称:angular,代码行数:11,代码来源:console_reporter.ts


示例3: _parseChromeVersion

 private _parseChromeVersion(userAgent: string): number {
   if (isBlank(userAgent)) {
     return -1;
   }
   var v = StringWrapper.split(userAgent, /Chrom(e|ium)\//g)[2];
   if (isBlank(v)) {
     return -1;
   }
   v = StringWrapper.split(v, /\./g)[0];
   if (isBlank(v)) {
     return -1;
   }
   return NumberWrapper.parseInt(v, 10);
 }
开发者ID:hankduan,项目名称:angular,代码行数:14,代码来源:chrome_driver_extension.ts


示例4:

 return elId.split(NG_ID_SEPARATOR).map(partStr => NumberWrapper.parseInt(partStr, 10));
开发者ID:hankduan,项目名称:angular,代码行数:1,代码来源:debug_element_view_listener.ts


示例5: _formatNum

 static _formatNum(n) { return NumberWrapper.toFixed(n, 2); }
开发者ID:hankduan,项目名称:angular,代码行数:1,代码来源:console_reporter.ts


示例6:

 (partStr) => NumberWrapper.parseInt(partStr, 10));
开发者ID:chiragjraval,项目名称:AdvisroySystemPOC,代码行数:1,代码来源:debug_element_view_listener.ts


示例7: BaseException

    events.forEach((event) => {
      var ph = event['ph'];
      var name = event['name'];
      var microIterations = 1;
      var microIterationsMatch = RegExpWrapper.firstMatch(_MICRO_ITERATIONS_REGEX, name);
      if (isPresent(microIterationsMatch)) {
        name = microIterationsMatch[1];
        microIterations = NumberWrapper.parseInt(microIterationsMatch[2], 10);
      }

      if (StringWrapper.equals(ph, 'b') && StringWrapper.equals(name, markName)) {
        markStartEvent = event;
      } else if (StringWrapper.equals(ph, 'e') && StringWrapper.equals(name, markName)) {
        markEndEvent = event;
      }

      if (isPresent(markStartEvent) && isBlank(markEndEvent) &&
          event['pid'] === markStartEvent['pid']) {
        if (StringWrapper.equals(ph, 'b') && StringWrapper.equals(name, _MARK_NAME_FRAME_CAPUTRE)) {
          if (isPresent(frameCaptureStartEvent)) {
            throw new BaseException('can capture frames only once per benchmark run');
          }
          if (!this._captureFrames) {
            throw new BaseException(
                'found start event for frame capture, but frame capture was not requested in benchpress')
          }
          frameCaptureStartEvent = event;
        } else if (StringWrapper.equals(ph, 'e') &&
                   StringWrapper.equals(name, _MARK_NAME_FRAME_CAPUTRE)) {
          if (isBlank(frameCaptureStartEvent)) {
            throw new BaseException('missing start event for frame capture');
          }
          frameCaptureEndEvent = event;
        }

        if (StringWrapper.equals(ph, 'I') || StringWrapper.equals(ph, 'i')) {
          if (isPresent(frameCaptureStartEvent) && isBlank(frameCaptureEndEvent) &&
              StringWrapper.equals(name, 'frame')) {
            frameTimestamps.push(event['ts']);
            if (frameTimestamps.length >= 2) {
              frameTimes.push(frameTimestamps[frameTimestamps.length - 1] -
                              frameTimestamps[frameTimestamps.length - 2]);
            }
          }
        }

        if (StringWrapper.equals(ph, 'B') || StringWrapper.equals(ph, 'b')) {
          if (isBlank(intervalStarts[name])) {
            intervalStartCount[name] = 1;
            intervalStarts[name] = event;
          } else {
            intervalStartCount[name]++;
          }
        } else if ((StringWrapper.equals(ph, 'E') || StringWrapper.equals(ph, 'e')) &&
                   isPresent(intervalStarts[name])) {
          intervalStartCount[name]--;
          if (intervalStartCount[name] === 0) {
            var startEvent = intervalStarts[name];
            var duration = (event['ts'] - startEvent['ts']);
            intervalStarts[name] = null;
            if (StringWrapper.equals(name, 'gc')) {
              result['gcTime'] += duration;
              var amount =
                  (startEvent['args']['usedHeapSize'] - event['args']['usedHeapSize']) / 1000;
              result['gcAmount'] += amount;
              var majorGc = event['args']['majorGc'];
              if (isPresent(majorGc) && majorGc) {
                result['majorGcTime'] += duration;
              }
              if (isPresent(intervalStarts['script'])) {
                gcTimeInScript += duration;
              }
            } else if (StringWrapper.equals(name, 'render')) {
              result['renderTime'] += duration;
              if (isPresent(intervalStarts['script'])) {
                renderTimeInScript += duration;
              }
            } else if (StringWrapper.equals(name, 'script')) {
              result['scriptTime'] += duration;
            } else if (isPresent(this._microMetrics[name])) {
              result[name] += duration / microIterations;
            }
          }
        }
      }
    });
开发者ID:hankduan,项目名称:angular,代码行数:86,代码来源:perflog_metric.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript lang.RegExpWrapper类代码示例发布时间:2022-05-25
下一篇:
TypeScript lang.Math类代码示例发布时间: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