@jargon/sdk-core
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -0,1 +1,4 @@ | ||
### 1.0.9 | ||
Fix bad release | ||
### 1.0.8 | ||
@@ -2,0 +5,0 @@ Fix handling of arrays in renderObject calls |
@@ -12,3 +12,4 @@ export declare class ICU { | ||
parseObject(res: object, options: any, lng: string, ns: string, path: string, info: any): {}; | ||
parseArray(res: any[], options: any, lng: string, ns: string, path: string, info: any): any[]; | ||
addLookupKeys(finalKeys: any, key: any, code: any, ns: any, options: any): any; | ||
} |
@@ -53,3 +53,3 @@ "use strict"; | ||
ICU.prototype.addLocaleData = function (data) { | ||
var locales = Object.prototype.toString.apply(data) === '[object Array]' ? data : [data]; | ||
var locales = Array.isArray(data) ? data : [data]; | ||
locales.forEach(function (localeData) { | ||
@@ -67,2 +67,5 @@ if (localeData && localeData.locale) { | ||
if (typeof res === 'object') { | ||
if (Array.isArray(res)) { | ||
return this.parseArray(res, options, lng, ns, key, info); | ||
} | ||
return this.parseObject(res, options, lng, ns, key, info); | ||
@@ -96,2 +99,13 @@ } | ||
}; | ||
ICU.prototype.parseArray = function (res, options, lng, ns, path, info) { | ||
var result = []; | ||
for (var k in res) { | ||
var key = path + "[" + k + "]"; | ||
// @ts-ignore | ||
var val = res[k]; | ||
// @ts-ignore | ||
result[k] = this.parse(val, options, lng, ns, key, info); | ||
} | ||
return result; | ||
}; | ||
ICU.prototype.addLookupKeys = function (finalKeys, key, code, ns, options) { | ||
@@ -98,0 +112,0 @@ // no additional keys needed for select or plural |
{ | ||
"name": "@jargon/sdk-core", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "Core components of Jargon's NodeJS SDK", | ||
@@ -5,0 +5,0 @@ "author": "jargon.com", |
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
60993
644