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

jsxgettext

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsxgettext - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

tests/expressions.js

20

lib/jsxgettext.js

@@ -24,2 +24,16 @@ #!/usr/bin/env node

function checkExpr(node, keyword) {
return (node.type === "CallExpression" && // must be a call expression
(
(node.callee.name === 'gettext' || // with a gettext call expr
(node.callee.name === keyword)) // or keyword call expr
||
(node.callee.type === 'MemberExpression' && // or a member expr
(node.callee.property.name === 'gettext' ||
node.callee.property.name === keyword))
)
&&
typeof node.arguments[0].value === 'string') // must have a string argument
}
// generate extracted strings file

@@ -37,7 +51,3 @@ function gen (sources, options) {

enter: function (node) {
if (node.type === "CallExpression" && // must be a call expression
(node.callee.name === 'gettext' || // must be a gettext call
(options.keyword && node.callee.name === options.keyword)) && // or a specified keyword call
typeof node.arguments[0].value === 'string' // must have a string argument
) {
if (checkExpr(node, options.keyword)) {
var str = node.arguments[0].value;

@@ -44,0 +54,0 @@ var line = node.loc.start.line;

@@ -5,3 +5,3 @@ {

"description": "Extract gettext calls from JavaScript and EJS files",
"version": "0.1.2",
"version": "0.1.3",
"repository": {

@@ -8,0 +8,0 @@ "type": "git",

@@ -12,2 +12,3 @@ // TODO figure out why

exports.testAll['test comments'] = require('./test_comment');
exports.testAll['test expressiosn'] = require('./expressions');

@@ -14,0 +15,0 @@ if (module == require.main) {

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