Socket
Socket
Sign inDemoInstall

i18next-scanner

Package Overview
Dependencies
Maintainers
1
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

i18next-scanner - npm Package Compare versions

Comparing version 1.9.0 to 1.9.1

test/fixtures/template-literals.js

4

lib/parser.js

@@ -326,2 +326,6 @@ 'use strict';

options[prop.key.name] = prop.value.value;
} else if (prop.value.type === 'TemplateLiteral') {
options[prop.key.name] = prop.value.quasis.map(function (element) {
return element.value.cooked;
}).join('');
} else {

@@ -328,0 +332,0 @@ // Unable to get value of the property

2

package.json
{
"name": "i18next-scanner",
"version": "1.9.0",
"version": "1.9.1",
"description": "Scan your code, extract translation keys/values, and merge them into i18n resource files.",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/i18next/i18next-scanner",

@@ -288,2 +288,6 @@ /* eslint no-console: 0 */

options[prop.key.name] = prop.value.value;
} else if (prop.value.type === 'TemplateLiteral') {
options[prop.key.name] = prop.value.quasis
.map(element => element.value.cooked)
.join('');
} else {

@@ -290,0 +294,0 @@ // Unable to get value of the property

@@ -528,1 +528,27 @@ import fs from 'fs';

});
test('Extract properties from template literals', (t) => {
const parser = new Parser({
defaultValue: function(lng, ns, key) {
if (lng === 'en') {
return key;
}
return '__NOT_TRANSLATED__';
},
keySeparator: false,
nsSeparator: false
});
const content = fs.readFileSync(path.resolve(__dirname, 'fixtures/template-literals.js'), 'utf8');
const wanted = {
"en": {
"translation": {
"property in template literals": "property in template literals",
}
}
};
parser.parseFuncFromString(content);
t.same(parser.get(), wanted);
t.end();
});
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