TypeScript numbro.format函数代码示例

您所在的位置:网站首页 numbro TypeScript numbro.format函数代码示例

TypeScript numbro.format函数代码示例

2024-07-05 17:08:18| 来源: 网络整理| 查看: 265

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

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

示例1: __guard__ string = string.replace(/(^|[^@])@(?:(\$?\w+)|{([^{}]+)})(?:{([^{}]+)})?/g, (_match, prefix, name, long_name, format) => { name = (long_name != null) ? long_name : name; const value = name[0] === "$" ? special_vars[name.substring(1)] : __guard__(data_source.get_column(name), x => x[i]); let replacement = null; if ((value == null)) { replacement = "???"; } else { // 'safe' format, just return the value as is if (format === 'safe') { return `${prefix}${value}`; } else if (format != null) { // see if the field has an entry in the formatters dict if ((formatters != null) && name in formatters) { if (formatters[name] === "numeral") { replacement = Numbro.format(value, format); } else if (formatters[name] === "datetime") { replacement = tz(value, format); } else if (formatters[name] === "printf") { replacement = sprintf(format, value); } else { throw new Error(`Unknown tooltip field formatter type '${ formatters[name] }'`); } // if not assume the format string is Numbro } else { replacement = Numbro.format(value, format); } // no format supplied, just use a basic default numeric format } else { replacement = _format_number(value); } } return replacement = `${prefix}${escape(replacement)}`; });开发者ID:FourtekIT-incubator,项目名称:bokeh,代码行数:46,代码来源:templating.ts 示例2: if str = str.replace(/(^|[^@])@(?:(\$?\w+)|{([^{}]+)})(?:{([^{}]+)})?/g, (_match, prefix, name, long_name, format) => { name = long_name != null ? long_name : name let value: any if (name[0] == "$") value = special_vars[name.substring(1)] else { const column = data_source.get_column(name) if (column != null) value = column[i] } let replacement = null if (value == null) replacement = "???" else { // 'safe' format, just return the value as is if (format == 'safe') return `${prefix}${value}` else if (format != null) { // see if the field has an entry in the formatters dict if (formatters != null && name in formatters) { const formatter = formatters[name] switch (formatter) { case "numeral": replacement = Numbro.format(value, format) break case "datetime": replacement = tz(value, format) break case "printf": replacement = sprintf(format, value) break default: throw new Error(`Unknown tooltip field formatter type '${formatter}'`) } // if not assume the format string is Numbro } else replacement = Numbro.format(value, format) // no format supplied, just use a basic default numeric format } else replacement = _format_number(value) } return `${prefix}${escape(replacement)}` })开发者ID:Zyell,项目名称:bokeh,代码行数:46,代码来源:templating.ts 示例3: doFormat doFormat(row: any, cell: any, value: any, columnDef: any, dataContext: any): string { const {format, language} = this const rounding = (() => { switch (this.rounding) { case "round": case "nearest": return Math.round case "floor": case "rounddown": return Math.floor case "ceil": case "roundup": return Math.ceil } })() value = Numbro.format(value, format, language, rounding) return super.doFormat(row, cell, value, columnDef, dataContext) }开发者ID:,项目名称:,代码行数:10,代码来源: 示例4: doFormat doFormat(row, cell, value, columnDef, dataContext) { const { format } = this; const { language } = this; const rounding = (() => { switch (this.rounding) { case "round": case "nearest": return Math.round; case "floor": case "rounddown": return Math.floor; case "ceil": case "roundup": return Math.ceil; } })(); value = Numbro.format(value, format, language, rounding); return super.doFormat(row, cell, value, columnDef, dataContext); }开发者ID:FourtekIT-incubator,项目名称:bokeh,代码行数:11,代码来源:cell_formatters.ts 示例5: return ticks.map((tick) => Numbro.format(tick, format, language, _rounding_fn))开发者ID:Zyell,项目名称:bokeh,代码行数:1,代码来源:numeral_tick_formatter.ts 示例6: function "numeral" : function(value:any, format:string, _special_vars: Vars) { return Numbro.format(value, format) },开发者ID:,项目名称:,代码行数:1,代码来源: 示例7: numeral: (value: string | number, format: string, _special_vars: Vars) => Numbro.format(value, format),开发者ID:digitalsatori,项目名称:Bokeh,代码行数:1,代码来源:templating.ts 示例8: const labels = (ticks.map((tick) => Numbro.format(tick, format, language, rounding)));开发者ID:FourtekIT-incubator,项目名称:bokeh,代码行数:1,代码来源:numeral_tick_formatter.ts

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



【本文地址】

公司简介

联系我们

今日新闻


点击排行

实验室常用的仪器、试剂和
说到实验室常用到的东西,主要就分为仪器、试剂和耗
不用再找了,全球10大实验
01、赛默飞世尔科技(热电)Thermo Fisher Scientif
三代水柜的量产巅峰T-72坦
作者:寞寒最近,西边闹腾挺大,本来小寞以为忙完这
通风柜跟实验室通风系统有
说到通风柜跟实验室通风,不少人都纠结二者到底是不
集消毒杀菌、烘干收纳为一
厨房是家里细菌较多的地方,潮湿的环境、没有完全密
实验室设备之全钢实验台如
全钢实验台是实验室家具中较为重要的家具之一,很多

推荐新闻


图片新闻

实验室药品柜的特性有哪些
实验室药品柜是实验室家具的重要组成部分之一,主要
小学科学实验中有哪些教学
计算机 计算器 一般 打孔器 打气筒 仪器车 显微镜
实验室各种仪器原理动图讲
1.紫外分光光谱UV分析原理:吸收紫外光能量,引起分
高中化学常见仪器及实验装
1、可加热仪器:2、计量仪器:(1)仪器A的名称:量
微生物操作主要设备和器具
今天盘点一下微生物操作主要设备和器具,别嫌我啰嗦
浅谈通风柜使用基本常识
 众所周知,通风柜功能中最主要的就是排气功能。在

专题文章

    CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭