Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jsexp

Package Overview
Dependencies
Maintainers
4
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsexp - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

5

package.json
{
"name": "jsexp",
"version": "0.0.8",
"version": "0.0.9",
"license": "MIT",
"scripts": {
"build": "rollup --config build/config.js"
"build": "rollup --config build/config.js",
"publish": "npm run build && npm publish"
},

@@ -8,0 +9,0 @@ "dependencies": {

24

transform.js

@@ -31,4 +31,12 @@ 'use strict';

function transform(expression) {
function transform(expression, callback) {
if (expression) {
if (callback) {
var expr = callback(expression);
if (Array.isArray(expr) && rulesMapReverse[expr[0]]) {
return expr;
}
}
var type = expression.type;

@@ -38,3 +46,3 @@ var originOperator = expression.operator;

if (originOperator === '@') {
var argument = transform(expression.argument);
var argument = transform(expression.argument, callback);
return isValidate(argument) ? "@".concat(argument) : undefined;

@@ -46,8 +54,8 @@ } else if (type === LITERAL) {

} else if (type === MEMBER_EXP) {
var object = transform(expression.object);
var property = transform(expression.property);
var object = transform(expression.object, callback);
var property = transform(expression.property, callback);
return isValidate(object) && isValidate(property) ? "".concat(object, ".").concat(property) : undefined;
} else if (type === ARRAY_EXP) {
return expression.elements.map(function (item) {
return transform(item);
return transform(item, callback);
});

@@ -59,8 +67,8 @@ } else {

if (type === UNARY_EXP) {
var _argument = transform(expression.argument);
var _argument = transform(expression.argument, callback);
return isValidate(_argument) ? [operator, _argument] : [];
} else if (type === LOGICAL_EXP || type === BINARY_EXP) {
var left = transform(expression.left);
var right = transform(expression.right);
var left = transform(expression.left, callback);
var right = transform(expression.right, callback);
return isValidate(left) && isValidate(right) ? [operator, left, right] : [];

@@ -67,0 +75,0 @@ }

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