Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@coorpacademy/translate

Package Overview
Dependencies
Maintainers
15
Versions
271
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@coorpacademy/translate - npm Package Compare versions

Comparing version 6.0.3 to 6.1.0

24

es/translate.js

@@ -1,7 +0,7 @@

import get from 'lodash/fp/get';
import has from 'lodash/fp/has';
import isString from 'lodash/fp/isString';
import isNumber from 'lodash/fp/isNumber';
import trim from 'lodash/fp/trim';
import replace from 'lodash/fp/replace';
import _replace from "lodash/fp/replace";
import _trim from "lodash/fp/trim";
import _isNumber from "lodash/fp/isNumber";
import _isString from "lodash/fp/isString";
import _has from "lodash/fp/has";
import _get from "lodash/fp/get";
const interpolation = /\{\{([\s\S]+?)\}\}/g;

@@ -12,3 +12,3 @@

if (!isNumber(count)) {
if (!_isNumber(count)) {
return regularTemplate;

@@ -29,12 +29,12 @@ }

const createTranslate = locales => (key, data) => {
const template = getTemplate(locales, key, get('count', data));
const template = getTemplate(locales, key, _get('count', data));
if (!isString(template)) {
if (!_isString(template)) {
throw new Error(`Key ${key} not found!`);
}
return replace(interpolation, (token, value) => {
const _value = trim(value);
return _replace(interpolation, (token, value) => {
const _value = _trim(value);
return has(_value, data) ? get(_value, data) : token;
return _has(_value, data) ? _get(_value, data) : token;
}, template);

@@ -41,0 +41,0 @@ };

@@ -7,13 +7,13 @@ "use strict";

var _get = _interopRequireDefault(require("lodash/fp/get"));
var _replace2 = _interopRequireDefault(require("lodash/fp/replace"));
var _has = _interopRequireDefault(require("lodash/fp/has"));
var _trim2 = _interopRequireDefault(require("lodash/fp/trim"));
var _isString = _interopRequireDefault(require("lodash/fp/isString"));
var _isNumber2 = _interopRequireDefault(require("lodash/fp/isNumber"));
var _isNumber = _interopRequireDefault(require("lodash/fp/isNumber"));
var _isString2 = _interopRequireDefault(require("lodash/fp/isString"));
var _trim = _interopRequireDefault(require("lodash/fp/trim"));
var _has2 = _interopRequireDefault(require("lodash/fp/has"));
var _replace = _interopRequireDefault(require("lodash/fp/replace"));
var _get2 = _interopRequireDefault(require("lodash/fp/get"));

@@ -27,3 +27,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

if (!(0, _isNumber.default)(count)) {
if (!(0, _isNumber2.default)(count)) {
return regularTemplate;

@@ -44,12 +44,12 @@ }

const createTranslate = locales => (key, data) => {
const template = getTemplate(locales, key, (0, _get.default)('count', data));
const template = getTemplate(locales, key, (0, _get2.default)('count', data));
if (!(0, _isString.default)(template)) {
if (!(0, _isString2.default)(template)) {
throw new Error(`Key ${key} not found!`);
}
return (0, _replace.default)(interpolation, (token, value) => {
const _value = (0, _trim.default)(value);
return (0, _replace2.default)(interpolation, (token, value) => {
const _value = (0, _trim2.default)(value);
return (0, _has.default)(_value, data) ? (0, _get.default)(_value, data) : token;
return (0, _has2.default)(_value, data) ? (0, _get2.default)(_value, data) : token;
}, template);

@@ -56,0 +56,0 @@ };

{
"name": "@coorpacademy/translate",
"version": "6.0.3",
"version": "6.1.0",
"description": "",

@@ -44,2 +44,3 @@ "main": "lib/translate.js",

"babel-plugin-istanbul": "^5.2.0",
"babel-plugin-lodash": "^3.3.4",
"cross-env": "^6.0.3",

@@ -50,3 +51,3 @@ "eslint": "^6.6.0",

"author": "CoorpAcademy",
"gitHead": "c002bf9c91bbc640f7fe0002d8c3452bcb001d96"
"gitHead": "95c36ff69253dc8d4e1cba28ed2fdf57c08f7276"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc