New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gulp-translatify

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-translatify - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

2

package.json
{
"name": "gulp-translatify",
"version": "0.1.0",
"version": "0.1.1",
"description": "Replaces long descriptive translation variables with shortcodes",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -49,6 +49,2 @@ var u = require('underscore'),

if (optimized) {
console.log('File has been optimized');
}
return fileContent;

@@ -69,4 +65,6 @@ };

function generateReplacementPatterns(search, replace) {
return [ // Example usage
return [ // Example usage
["\'" + search + "\'", "'" + replace + "'"], // 'VARIABLENAME' | translate
["\"" + search + "\"", '"' + replace + '"'], // ["VARIABLENAME"]
["\{" + search + "\:", "{" + replace + ":"], // {INFOPAGE_PRIVACYPOLICY_TITLE:"
["\," + search + "\:", "," + replace + ":"], // ,INFOPAGE_PRIVACYPOLICY_TITLE:"

@@ -76,3 +74,3 @@ ["\,\n" + search + "\:", "," + replace + ":"], // [new line],INFOPAGE_PRIVACYPOLICY_TITLE:"

["\>" + search + "\<", ">" + replace + "<"], // <span translate>VARIABLENAME</span>
["translation\." + search, "translation." + replace], // var stomtBecause = translation.STOMT_BECAUSE;
["translation\." + search, "translation." + replace], // var stomtBecause = translation.STOMT_BECAUSE;
];

@@ -99,7 +97,7 @@ }

var translationFileString = fs.readFileSync(translationFile, 'utf8'),
translationVariables = translationFileString.match(/'([0-9A-Z_,.-]*?)'/g);
translationVariables = translationFileString.match(/'([0-9A-Z_,.-]*?)':/g);
vars = vars.concat(translationVariables);
});
// Remove enclosing single-quotes
vars = JSON.parse(JSON.stringify(vars).replace(/\'/g, ''));
// Remove enclosing single-quotes and the double point
vars = JSON.parse(JSON.stringify(vars).replace(/\'/g, '').replace(/\:/g, ''));
// Flatten array

@@ -106,0 +104,0 @@ vars = u.flatten(vars);

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