@jargon/sdk-core
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -0,1 +1,4 @@ | ||
### 1.1.1 | ||
Support nested `RenderItem` parameters in `ResourceManager.renderObject` | ||
### 1.1.0 | ||
@@ -30,3 +33,3 @@ Add built-in resources for common scenarios. These resources are available using the `RenderItem` keys: | ||
or when you want the SDK to select across multiple variations for a parameter value, and reduces | ||
the need to chain together multiple calls into the ResourceManager. | ||
the need to chain together multiple calls into the `ResourceManager`. | ||
@@ -33,0 +36,0 @@ ### 1.0.3 |
@@ -132,8 +132,23 @@ "use strict"; | ||
I18NextResourceManager.prototype.renderObject = function (item) { | ||
var obj = this._translator.t(item.key, item.params); | ||
var t = typeof obj; | ||
if (t === 'object' || t === 'string' || t === 'boolean' || t === 'number') { | ||
return Promise.resolve(obj); | ||
} | ||
return Promise.reject(new Error("Unexpected type " + t + " for item key " + item.key)); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var params, obj, t; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
params = item.params; | ||
if (!params) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, this.processParams(params)]; | ||
case 1: | ||
params = _a.sent(); | ||
_a.label = 2; | ||
case 2: | ||
obj = this._translator.t(item.key, params); | ||
t = typeof obj; | ||
if (t === 'object' || t === 'string' || t === 'boolean' || t === 'number') { | ||
return [2 /*return*/, Promise.resolve(obj)]; | ||
} | ||
return [2 /*return*/, Promise.reject(new Error("Unexpected type " + t + " for item key " + item.key))]; | ||
} | ||
}); | ||
}); | ||
}; | ||
@@ -140,0 +155,0 @@ I18NextResourceManager.prototype.selectedVariation = function (item) { |
{ | ||
"name": "@jargon/sdk-core", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"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
66310
720