bobril-g11n
Advanced tools
Comparing version 5.1.0 to 5.1.1
# CHANGELOG | ||
## 5.1.1 | ||
Fixed that in some cases eval was still used eventhough disabled with `setNoEval()`. | ||
## 5.1.0 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "bobril-g11n", | ||
"version": "5.1.0", | ||
"version": "5.1.1", | ||
"description": "Bobril globalization", | ||
@@ -40,2 +40,2 @@ "main": "index.js", | ||
"license": "MIT" | ||
} | ||
} |
@@ -0,0 +0,0 @@ # bobril-g11n |
@@ -0,0 +0,0 @@ export interface ILocaleRules { |
@@ -0,0 +0,0 @@ import { isObject, isArray } from "bobril"; |
@@ -13,7 +13,7 @@ import * as moment from "moment"; | ||
function getFormatter(locale: string, format: string): (val: number) => string { | ||
const key = locale + "|" + format; | ||
function getFormatter(locale: string, format: string, interpret: boolean): (val: number) => string { | ||
const key = interpret + "|" + locale + "|" + format; | ||
let res = numberFormatterCache[key]; | ||
if (res) return res; | ||
res = numberFormatter.buildFormatter(localeDataStorage.getRules(locale), format); | ||
res = numberFormatter.buildFormatter(localeDataStorage.getRules(locale), format, interpret); | ||
numberFormatterCache[key] = res; | ||
@@ -32,3 +32,4 @@ return res; | ||
style: string, | ||
options: Object | ||
options: Object, | ||
interpret: boolean | ||
): (value: any, options: Object) => string { | ||
@@ -40,14 +41,14 @@ switch (type) { | ||
return (val, opt) => { | ||
return getFormatter(locale, (opt as any).format)(val); | ||
return getFormatter(locale, (opt as any).format, interpret)(val); | ||
}; | ||
return getFormatter(locale, (options as any).format); | ||
return getFormatter(locale, (options as any).format, interpret); | ||
} | ||
if (style === "default") { | ||
return getFormatter(locale, "0,0.[0000]"); | ||
return getFormatter(locale, "0,0.[0000]", interpret); | ||
} | ||
if (style === "percent") { | ||
return getFormatter(locale, "0%"); | ||
return getFormatter(locale, "0%", interpret); | ||
} | ||
if (style === "bytes") { | ||
return getFormatter(locale, "0b"); | ||
return getFormatter(locale, "0b", interpret); | ||
} | ||
@@ -226,3 +227,3 @@ break; | ||
} | ||
let formatFn = AnyFormatter(locale, type, style, opts); | ||
let formatFn = AnyFormatter(locale, type, style, opts, interpret); | ||
if (complex) { | ||
@@ -241,3 +242,3 @@ let optLocal = opts; | ||
} else { | ||
let formatFn = AnyFormatter(locale, type, style, {}); | ||
let formatFn = AnyFormatter(locale, type, style, {}, interpret); | ||
return formatFn(local, {}); | ||
@@ -307,4 +308,4 @@ } | ||
(id: number, valueFactory: (params?: Object, hashArg?: string) => any) => | ||
(params?: Object, hashArg?: string) => | ||
(<any>params)[id](valueFactory(params, hashArg)) | ||
(params?: Object, hashArg?: string) => | ||
(<any>params)[id](valueFactory(params, hashArg)) | ||
)(msgAst.id, compile(locale, msgAst.value)); | ||
@@ -399,3 +400,3 @@ } | ||
} | ||
let formatFn = comp.addConstant(AnyFormatter(locale, type, style, opts)); | ||
let formatFn = comp.addConstant(AnyFormatter(locale, type, style, opts, interpret)); | ||
if (complex) { | ||
@@ -420,3 +421,3 @@ let optConst = comp.addConstant(opts); | ||
} else { | ||
let formatFn = comp.addConstant(AnyFormatter(locale, type, style, {})); | ||
let formatFn = comp.addConstant(AnyFormatter(locale, type, style, {}, interpret)); | ||
comp.addBody(`return ${formatFn}(${localArg});`); | ||
@@ -423,0 +424,0 @@ } |
@@ -0,0 +0,0 @@ import { ILocaleRules } from "./localeDataStorage"; |
@@ -0,0 +0,0 @@ export class RuntimeFunctionGenerator { |
@@ -36,3 +36,3 @@ { | ||
"files": [ | ||
"C:/Users/b.letocha/.bbcore/tools/jasmine330.d.ts" | ||
"/Users/borisletocha/.bbcore/tools/jasmine330.d.ts" | ||
], | ||
@@ -39,0 +39,0 @@ "include": [ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1470
64961