Socket
Socket
Sign inDemoInstall

gettext-parser

Package Overview
Dependencies
Maintainers
2
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gettext-parser - npm Package Compare versions

Comparing version 7.0.0 to 7.0.1

75

lib/poparser.js

@@ -268,45 +268,44 @@ const encoding = require('encoding');

tokens.forEach(node => {
let comment;
let lines;
if (!node || node.type !== this.types.comments) {
return;
}
if (node && node.type === this.types.comments) {
comment = {
translator: [],
extracted: [],
reference: [],
flag: [],
previous: []
};
const comment = {
translator: [],
extracted: [],
reference: [],
flag: [],
previous: []
};
lines = (node.value || '').split(/\n/);
const lines = (node.value || '').split(/\n/);
lines.forEach(line => {
switch (line.charAt(0) || '') {
case ':':
comment.reference.push(line.substr(1).trim());
break;
case '.':
comment.extracted.push(line.substr(1).replace(/^\s+/, ''));
break;
case ',':
comment.flag.push(line.substr(1).replace(/^\s+/, ''));
break;
case '|':
comment.previous.push(line.substr(1).replace(/^\s+/, ''));
break;
case '~':
break;
default:
comment.translator.push(line.replace(/^\s+/, ''));
}
});
lines.forEach(line => {
switch (line.charAt(0) || '') {
case ':':
comment.reference.push(line.substr(1).trim());
break;
case '.':
comment.extracted.push(line.substr(1).replace(/^\s+/, ''));
break;
case ',':
comment.flag.push(line.substr(1).replace(/^\s+/, ''));
break;
case '|':
comment.previous.push(line.substr(1).replace(/^\s+/, ''));
break;
case '~':
break;
default:
comment.translator.push(line.replace(/^\s+/, ''));
}
});
node.value = {};
node.value = {};
Object.keys(comment).forEach(key => {
if (comment[key] && comment[key].length) {
node.value[key] = comment[key].join('\n');
}
});
}
Object.keys(comment).forEach(key => {
if (comment[key] && comment[key].length) {
node.value[key] = comment[key].join('\n');
}
});
});

@@ -313,0 +312,0 @@ };

{
"name": "gettext-parser",
"description": "Parse and compile gettext po and mo files to/from json, nothing more, nothing less",
"version": "7.0.0",
"version": "7.0.1",
"author": "Andris Reinman",

@@ -6,0 +6,0 @@ "contributors": [

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