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

ast-query

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ast-query - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

test/nodes/ArrayExpression.js

3

lib/factory/value.js

@@ -0,1 +1,2 @@

'use strict';
var esprima = require('esprima');

@@ -45,5 +46,5 @@ var escodegen = require('escodegen');

// Prewrap the elements so it isn't consider a list of node
return new ArrayExpression([node.elements]);
return new ArrayExpression([node]);
}
return node;
};

@@ -0,1 +1,2 @@

'use strict';
var valueFactory = require('../factory/value.js');

@@ -5,2 +6,6 @@ var Base = require('./Base');

var ArrayExpression = module.exports = Base.extend({
initialize: function () {
this.type = 'ArrayExpression';
},
/**

@@ -14,3 +19,3 @@ * push a new value in the array

this.nodes.forEach(function (node) {
node.push(arg);
node.elements.push(arg);
});

@@ -28,3 +33,3 @@ return this;

this.nodes.forEach(function (node) {
node.unshift(arg);
node.elements.unshift(arg);
});

@@ -40,3 +45,3 @@ return this;

at: function (index) {
return valueFactory.wrap(this.nodes[0][index]);
return valueFactory.wrap(this.nodes[0].elements[index]);
}

@@ -43,0 +48,0 @@

@@ -0,1 +1,2 @@

'use strict';
var _ = require('lodash');

@@ -2,0 +3,0 @@ var valueFactory = require('../factory/value.js');

@@ -0,1 +1,2 @@

'use strict';
var Base = module.exports = function (nodes) {

@@ -2,0 +3,0 @@ this.nodes = Array.isArray(nodes) ? nodes : [nodes];

@@ -0,1 +1,2 @@

'use strict';
var esprima = require('esprima');

@@ -2,0 +3,0 @@

@@ -0,1 +1,2 @@

'use strict';
var valueFactory = require('../factory/value.js');

@@ -13,3 +14,3 @@ var ArrayExpression = require('./ArrayExpression.js');

this.type = 'CallExpression';
this.arguments = new ArrayExpression(this.nodes.map(function (node) { return node.arguments; }));
this.arguments = new ArrayExpression({elements: this.nodes[0].arguments});
},

@@ -16,0 +17,0 @@

@@ -0,1 +1,2 @@

'use strict';
var _ = require('lodash');

@@ -2,0 +3,0 @@ var valueFactory = require('../factory/value');

@@ -0,1 +1,2 @@

'use strict';
var _ = require('lodash');

@@ -2,0 +3,0 @@ var valueFactory = require('../../lib/factory/value.js');

@@ -0,1 +1,2 @@

'use strict';
var _ = require('lodash');

@@ -58,3 +59,3 @@ var valueFactory = require('../factory/value.js');

// the same reference.
delete this.node.property;
delete this.node.properties;
delete this.node.type;

@@ -61,0 +62,0 @@ this.node.TEMP = false;

@@ -0,1 +1,2 @@

'use strict';
var _ = require('lodash');

@@ -2,0 +3,0 @@ var valueFactory = require('../factory/value.js');

@@ -0,4 +1,6 @@

'use strict';
var esprima = require('esprima');
var escodegen = require('escodegen');
var traverse = require('traverse');
var _ = require('lodash');
var utils = require('./util/utils');

@@ -9,3 +11,2 @@ var Variable = require('./nodes/Variable');

var Body = require('./nodes/Body');
var _ = require('lodash');

@@ -12,0 +13,0 @@ var esprimaOptions = {

@@ -0,1 +1,2 @@

'use strict';
/**

@@ -2,0 +3,0 @@ * Match a MemberExpression node against a name.

{
"name": "ast-query",
"version": "0.3.0",
"version": "0.3.1",
"description": "Declarative JavaScript AST modification façade",

@@ -18,20 +18,17 @@ "main": "lib/tree.js",

},
"repository": {
"type": "git",
"url": "git@github.com:SBoudrias/AST-query.git"
},
"repository": "SBoudrias/AST-query",
"dependencies": {
"esprima": "~1.1.1",
"escodegen": "~1.3.1",
"lodash": "~2.4.1",
"traverse": "~0.6.6",
"class-extend": "~0.1.1"
"class-extend": "^0.1.1",
"escodegen": "^1.6.0",
"esprima": "^1.2.3",
"lodash": "^2.4.1",
"traverse": "^0.6.6"
},
"devDependencies": {
"grunt": "~0.4.1",
"grunt-cli": "~0.1.9",
"grunt-contrib-jshint": "~0.10.0",
"grunt-simple-mocha": "~0.4.0",
"grunt-release": "~0.7.0"
"grunt": "^0.4.5",
"grunt-cli": "^0.1.9",
"grunt-contrib-jshint": "^0.11.0",
"grunt-release": "^0.10.0",
"grunt-simple-mocha": "^0.4.0"
}
}

@@ -31,3 +31,3 @@ var assert = require('assert');

obj.var('b').value().key('c').value('1');
assert.equal(obj.toString(), 'var b = {\n a: null,\n c: 1\n };');
assert.equal(obj.toString(), 'var b = {\n a: null,\n c: 1\n};');
});

@@ -34,0 +34,0 @@

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