@coorpacademy/translate
Advanced tools
Comparing version 3.0.0-beta.3-alpha.6daaa06c to 3.0.0-beta.3-alpha.9c490b6d
import get from 'lodash/fp/get'; | ||
import has from 'lodash/fp/has'; | ||
import trim from 'lodash/fp/trim'; | ||
import replace from 'lodash/fp/replace'; | ||
@@ -11,6 +12,6 @@ var interpolation = /\{\{([\s\S]+?)\}\}/g; | ||
return template.replace(interpolation, function (token, value) { | ||
return replace(interpolation, function (token, value) { | ||
var _value = trim(value); | ||
return has(_value, data) ? get(_value, data) : token; | ||
}); | ||
}, template); | ||
}; | ||
@@ -17,0 +18,0 @@ }; |
@@ -17,2 +17,6 @@ 'use strict'; | ||
var _replace = require('lodash/fp/replace'); | ||
var _replace2 = _interopRequireDefault(_replace); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -26,6 +30,6 @@ | ||
return template.replace(interpolation, function (token, value) { | ||
return (0, _replace2.default)(interpolation, function (token, value) { | ||
var _value = (0, _trim2.default)(value); | ||
return (0, _has2.default)(_value, data) ? (0, _get2.default)(_value, data) : token; | ||
}); | ||
}, template); | ||
}; | ||
@@ -32,0 +36,0 @@ }; |
{ | ||
"name": "@coorpacademy/translate", | ||
"version": "3.0.0-beta.3-alpha.6daaa06c", | ||
"version": "3.0.0-beta.3-alpha.9c490b6d", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/translate.js", |
import get from 'lodash/fp/get'; | ||
import has from 'lodash/fp/has'; | ||
import trim from 'lodash/fp/trim'; | ||
import replace from 'lodash/fp/replace'; | ||
@@ -10,3 +11,3 @@ const interpolation = /\{\{([\s\S]+?)\}\}/g; | ||
return template.replace( | ||
return replace( | ||
interpolation, | ||
@@ -18,3 +19,4 @@ (token, value) => { | ||
token; | ||
} | ||
}, | ||
template | ||
); | ||
@@ -21,0 +23,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
46329
505
21
1