factorial-i18n
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -7,3 +7,4 @@ 'use strict'; | ||
var at = require('lodash.at'); | ||
var at = require('lodash/at'); | ||
var isEmpty = require('lodash/isEmpty'); | ||
var I18n = /** @class */ (function () { | ||
@@ -29,2 +30,5 @@ function I18n() { | ||
I18n.prototype.getKey = function (path) { | ||
if (isEmpty(this.translations)) { | ||
throw new Error('Translations have not been loaded'); | ||
} | ||
return at(this.translations[this.locale], path)[0]; | ||
@@ -44,3 +48,3 @@ }; | ||
if (typeof value !== 'string') { | ||
throw new Error("Key \"" + path + "\"is not a leaf"); | ||
throw new Error("Key \"" + path + "\" is not a leaf"); | ||
} | ||
@@ -47,0 +51,0 @@ var MATCH = /%\{([^}]+)\}/g; |
{ | ||
"name": "factorial-i18n", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Factorial i18n library", | ||
@@ -12,3 +12,3 @@ "repository": { | ||
"dependencies": { | ||
"lodash.at": "4.6.0", | ||
"lodash": "^4.17.15", | ||
"plurals-cldr": "1.0.3" | ||
@@ -15,0 +15,0 @@ }, |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
18406
30
341
+ Addedlodash@^4.17.15
+ Addedlodash@4.17.21(transitive)
- Removedlodash.at@4.6.0
- Removedlodash.at@4.6.0(transitive)