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

jsmartier

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsmartier - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

11

jsmartier.js

@@ -5,3 +5,3 @@ /**

*/
console.log('jsmartier version 0.1.4');
console.log('jsmartier version 0.1.5');
// modules

@@ -101,3 +101,3 @@ var FS = require('fs');

conf = conf[args.section];
console.log(args.file, conf);
// console.log(args.file, conf);
var scope = args.scope === 'global' ? config.__global__ : args.scope === 'parent' ? config.__proto__ : config;

@@ -181,3 +181,8 @@ for ( var k in conf) {

function pathFormat(path) {
return path.replace(/\/\/+/g, '/').replace(/(^|\/)[^\/]+\/\.\.\//g, '$1').replace(/\.\//g, '');
var len;
do {
len = path.length;
path = path.replace(/(^|\/)[^\/]+\/\.\.\//g, '$1');
} while (path.length < len);
return path.replace(/\/\/+/g, '/').replace(/\.\//g, '');
}

@@ -184,0 +189,0 @@

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

"main": "jsmartier.js",
"version": "0.1.4",
"version": "0.1.5",
"scripts": {

@@ -8,0 +8,0 @@ "test": "echo \"Error: no test specified\" && exit 1"

@@ -45,7 +45,5 @@ var stringify = JSON.stringify;

append : function(vars, config, args) {
vars[args['var']][args.index] = args.value;
(vars[args['var']] || (vars[args['var']] = {}))[args.index] = args.value;
return '';
},
"default" : function(str, _default) {
return str || _default;
},
forEach : function(vars, config, args, cb) {

@@ -91,8 +89,12 @@ var arr = args.from, $item = args.item, $name = args.name, buf = '';

if (legacy) {
script = script.replace(/vars(?:\.\w+){2,}/g, function(m) {
var idx = m.indexOf('.', 6), buf = m.substr(0, idx);
while ((idx = m.indexOf('.', idx + 1)) != -1) {
buf += '&&' + m.substr(0, idx);
script = script.replace(/vars(?:\.\w+)+/g, function(m) {
var idx = m.indexOf('.', 6);
if (idx === -1)
return '(' + m + '||"")';
else {
var buf = m.substr(0, idx);
while ((idx = m.indexOf('.', idx + 1)) != -1) {
buf += '&&' + m.substr(0, idx);
}
}
return '(' + buf + '&&' + m + '||"")';

@@ -102,3 +104,3 @@ });

// console.log('function anonymous($){' + script + '}');
console.log('function anonymous($){' + script + '}');
try {

@@ -135,3 +137,11 @@ return new Function('$', script)(plugins);

break;
buf += '+' + stringify(text.substr(0, idx));
if (text.charAt(idx + prefix.length) === '*') { // comment
var idx2 = text.indexOf('*' + suffix, idx + prefix.length + 1);
if (idx2 === -1)
throw "Unterminated comment";
buf += '+' + stringify(text.substr(0, idx));
text = text.substr(idx2 + suffix.length + 1);
continue;
}
var content = '', start = idx + prefix.length, idx2;

@@ -148,2 +158,3 @@ while (true) {

content = content.substr(0, idx3) + '"' + transform(content.substring(idx3 + prefix.length, idx2), stack) + '+"';
console.log(content);
start = idx2 + suffix.length;

@@ -161,3 +172,3 @@ }

buf += ';};';
buf = buf.replace(/"\+"|/g, '').replace(/\+""\+/g, '+').replace(/ ""\+/g, ' ');
buf = buf.replace(/"\+"|/g, '').replace(/\+""\+/g, '+').replace(/ ""\+/g, ' ').replace(/(vars(?:\.\w+)*)\.(\d)/g, '$1[$2]');
return buf;

@@ -167,4 +178,2 @@

function transform(content, stack) {
if (content.charAt(0) == '*')
return '';
content = content.trim();

@@ -245,3 +254,3 @@

function expand(content) { // TODO fix expression expansion
function expand(content) {
var oldLen;

@@ -256,3 +265,3 @@ content = content.replace(/#(\w+)#/g, 'config.$1').replace(/\$/g, 'vars.').replace(/->/g, '.');

if (name === 'default') {
expr = '(' + expr + '||' + args[1] + ')';
expr = '(' + expr + '||' + args[0] + ')';
} else {

@@ -268,3 +277,2 @@ if (name.charAt(0) === '@')

}
console.log(args);
args.forEach(function(opt) {

@@ -271,0 +279,0 @@ if (/^\w+$/.test(opt))

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