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


TypeScript lodash.toNumber函数代码示例

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


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

示例1: configureAxisOptions

      function configureAxisOptions(data, options) {
        var defaults = {
          position: 'left',
          show: panel.yaxes[0].show,
          index: 1,
          logBase: panel.yaxes[0].logBase || 1,
          min: panel.yaxes[0].min ? _.toNumber(panel.yaxes[0].min) : null,
          max: panel.yaxes[0].max ? _.toNumber(panel.yaxes[0].max) : null,
        };

        options.yaxes.push(defaults);

        if (_.find(data, {yaxis: 2})) {
          var secondY = _.clone(defaults);
          secondY.index = 2;
          secondY.show = panel.yaxes[1].show;
          secondY.logBase = panel.yaxes[1].logBase || 1;
          secondY.position = 'right';
          secondY.min = panel.yaxes[1].min ? _.toNumber(panel.yaxes[1].min) : null;
          secondY.max = panel.yaxes[1].max ? _.toNumber(panel.yaxes[1].max) : null;
          options.yaxes.push(secondY);

          applyLogScale(options.yaxes[1], data);
          configureAxisMode(options.yaxes[1], panel.percentage && panel.stack ? "percent" : panel.yaxes[1].format);
        }
        applyLogScale(options.yaxes[0], data);
        configureAxisMode(options.yaxes[0], panel.percentage && panel.stack ? "percent" : panel.yaxes[0].format);
      }
开发者ID:casaria,项目名称:grafana-trillium-src-fork,代码行数:28,代码来源:graph.ts

示例2: tickFormatter

 function tickFormatter(valIndex) {
   let valueFormatted = tsBuckets[valIndex];
   if (!_.isNaN(_.toNumber(valueFormatted)) && valueFormatted !== '') {
     // Try to format numeric tick labels
     valueFormatted = tickValueFormatter(decimals)(_.toNumber(valueFormatted));
   }
   return valueFormatted;
 }
开发者ID:fangjianfeng,项目名称:grafana,代码行数:8,代码来源:rendering.ts

示例3: parseNumber

  parseNumber(value: any) {
    if (value === null || typeof value === 'undefined') {
      return null;
    }

    return _.toNumber(value);
  }
开发者ID:CorpGlory,项目名称:grafana,代码行数:7,代码来源:graph.ts

示例4: _getDuplicateFailure

 private _getDuplicateFailure(key: string, imports: ImportOrExportDeclaration[]) {
     const values = key.split('|');
     const kind = _.toNumber(key.split('|')[0]);
     const name = values[1];
     const message = `order imports: duplicate ${ts.SyntaxKind[kind].toLowerCase()} '${name}' found and should be consolidated`;
     return _.map(imports, x => this.createFailure(x.getStart(), x.getWidth(), message));
 }
开发者ID:OmniSharp,项目名称:atom-languageclient,代码行数:7,代码来源:orderImportsRule.ts

示例5: toNumber

/** Will return any value as a number or NaN */
function toNumber(value: any): number {
  if (typeof value === 'number') {
    return value;
  }
  if (value === null || value === undefined || Array.isArray(value)) {
    return NaN; // lodash calls them 0
  }
  if (typeof value === 'boolean') {
    return value ? 1 : 0;
  }
  return _.toNumber(value);
}
开发者ID:grafana,项目名称:grafana,代码行数:13,代码来源:displayValue.ts

示例6: parseInt

export const fromConwayNotation = (notation: string) => {
  const prefix = notation[0];
  const number = parseInt(notation.substring(1));
  if (platonicMapping.get(notation)) {
    return platonicMapping.get(notation);
  }
  if (archimedeanMapping.get(notation)) {
    return archimedeanMapping.get(notation);
  }
  if (prefix === 'J') {
    return johnsonSolids[_.toNumber(number) - 1];
  }
  if (prefix === 'P') {
    return `${polygonPrefixes.get(number)} prism`;
  }
  if (prefix === 'A') {
    return `${polygonPrefixes.get(number)} antiprism`;
  }
  return '';
};
开发者ID:tessenate,项目名称:polyhedra-viewer,代码行数:20,代码来源:names.ts

示例7: autoCastValue

export function autoCastValue(value: any): any {
  if (_.isArray(value)) {
    return value.map(value => value.toString());
  }
  if (_.isString(value)) { // String
    return value;
  }
  if (_.isBoolean(value)) { // Boolean
    return Boolean(value);
  }
  if (_.isNumber(value)) {
    return _.toNumber(value);
  }
  if (Long.isLong(value)) {
    return (value as Long).toNumber();
  }
  if (_.isDate(value)) { // Date
    return new Date(value);
  }
  return value;
}
开发者ID:restorecommerce,项目名称:chassis-srv,代码行数:21,代码来源:common.ts

示例8: restoreTask

 private restoreTask(taskId: number) {
     taskId = _.toNumber(taskId);
     if (this.taskStacks.has(taskId)) {
         let stack = _.clone(this.taskStacks.get(taskId)),
             section = stack[0].object,
             sectionId = section.id;
         let taskState = this.datastoreService.getState().get(Model.Task);
         if (taskState &&
             taskState.get((taskId as any)) &&
             taskState.get(taskId).get('error')) {
             _.last(stack).error = taskState.get(taskId).get('error').toJS();
         }
         if (this.currentStacks.has(sectionId)) {
             this.currentStacks.set(sectionId, stack);
         } else {
             this.sectionRouters.get(sectionId).restore(stack);
         }
         this.eventDispatcherService.dispatch('sectionRestored', stack);
         this.changeHash(_.last(stack).path);
     }
 }
开发者ID:pchaussalet,项目名称:gui,代码行数:21,代码来源:routing-service.ts

示例9:

 name => _.toNumber(name.substring(commonPrefix.length))
开发者ID:mactanxin,项目名称:gui,代码行数:1,代码来源:boot-pool-repository.ts

示例10: function

	savers[n] = function() { return _.toNumber($('#'+n).val()); };
开发者ID:UnlitStudio,项目名称:PlazaPlus,代码行数:1,代码来源:options.ts


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