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.8.0 to 1.9.0

test/fixtures/multiline-dos.js

5

lib/parser.js

@@ -278,3 +278,3 @@ 'use strict';

}).value().join('|').replace(/\./g, '\\.');
var pattern = '(?:(?:^[\\s]*)|[^a-zA-Z0-9_])(?:' + matchPattern + ')\\(("(?:[^"\\\\]|\\\\.)*"|\'(?:[^\'\\\\]|\\\\.)*\')\\s*[\\,\\)]';
var pattern = '(?:(?:^\\s*)|[^a-zA-Z0-9_])(?:' + matchPattern + ')\\(("(?:[^"\\\\]|\\\\(?:.|$))*"|\'(?:[^\'\\\\]|\\\\(?:.|$))*\')\\s*[,)]';
var re = new RegExp(pattern, 'gim');

@@ -295,2 +295,5 @@

// restore multiline strings
key = key.replace(/(\\\n|\\\r\n)/g, '');
// JavaScript character escape sequences

@@ -297,0 +300,0 @@ // https://mathiasbynens.be/notes/javascript-escapes

4

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

@@ -18,3 +18,3 @@ "homepage": "https://github.com/i18next/i18next-scanner",

"build": "babel ./src --out-dir ./lib",
"test": "tap test/*.js --coverage --nyc-arg=--require --nyc-arg=babel-register --nyc-arg=--require --nyc-arg=babel-polyfill",
"test": "tap test/*.js --node-arg=--require --node-arg=babel-register --node-arg=--require --node-arg=babel-polyfill",
"lint": "eslint ./src",

@@ -21,0 +21,0 @@ "lint:fix": "eslint --fix ./src",

@@ -239,3 +239,3 @@ /* eslint no-console: 0 */

.replace(/\./g, '\\.');
const pattern = '(?:(?:^[\\s]*)|[^a-zA-Z0-9_])(?:' + matchPattern + ')\\(("(?:[^"\\\\]|\\\\.)*"|\'(?:[^\'\\\\]|\\\\.)*\')\\s*[\\,\\)]';
const pattern = '(?:(?:^\\s*)|[^a-zA-Z0-9_])(?:' + matchPattern + ')\\(("(?:[^"\\\\]|\\\\(?:.|$))*"|\'(?:[^\'\\\\]|\\\\(?:.|$))*\')\\s*[,)]';
const re = new RegExp(pattern, 'gim');

@@ -256,2 +256,5 @@

// restore multiline strings
key = key.replace(/(\\\n|\\\r\n)/g, '');
// JavaScript character escape sequences

@@ -258,0 +261,0 @@ // https://mathiasbynens.be/notes/javascript-escapes

@@ -312,2 +312,36 @@ import fs from 'fs';

test('Multiline (Line Endings: LF)', (t) => {
const parser = new Parser({
nsSeparator: false,
});
const content = fs.readFileSync(path.resolve(__dirname, 'fixtures/multiline-unix.js'), 'utf-8');
parser.parseFuncFromString(content);
t.same(parser.get(), {
en: {
translation: {
"this is a multiline string": "",
"this is another multiline string": ""
}
}
});
t.end();
});
test('Multiline (Line Endings: CRLF)', (t) => {
const parser = new Parser({
nsSeparator: false,
});
const content = fs.readFileSync(path.resolve(__dirname, 'fixtures/multiline-dos.js'), 'utf-8');
parser.parseFuncFromString(content);
t.same(parser.get(), {
en: {
translation: {
"this is a multiline string": "",
"this is another multiline string": ""
}
}
});
t.end();
});
test('Plural', (t) => {

@@ -314,0 +348,0 @@ const parser = new Parser();

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