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

es3-safe-recast

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es3-safe-recast - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

6

index.js

@@ -54,3 +54,7 @@ var recast = require('recast');

var TEST_REGEX = module.exports.TEST_REGEX = /catch|finally/i;
var TEST_REGEX = module.exports.TEST_REGEX = buildTestRegex();
function buildTestRegex() {
var regexString = Object.keys(identifierToLiteral).join('|');
return new RegExp(regexString, 'i');
}

@@ -57,0 +61,0 @@ module.exports.visit = function(ast) {

3

package.json
{
"name": "es3-safe-recast",
"version": "0.0.4",
"version": "0.0.5",
"description": "esprima/recast es3 safe compile step",

@@ -21,3 +21,2 @@ "main": "index.js",

"recast": "~0.5.20",
"es6-computed-property-keys": "~0.1.1",
"es-simpler-traverser": "0.0.1",

@@ -24,0 +23,0 @@ "esprima": "~1.2.2"

@@ -26,1 +26,113 @@ var assert = require('better-assert');

});
describe('catch', function() {
it('works with literal syntax', function() {
var actual = compiler.compile('var object = {\ncatch: null,\n};');
var expected = 'var object = {\n"catch": null,\n};'
astEqual(actual, expected, 'expected input.js and output.js to match');
});
it('works with member syntax', function() {
var actual = compiler.compile('object.catch(function(){\n\n});');
var expected = 'object["catch"](function(){\n\n});';
astEqual(actual, expected, 'expected input.js and output.js to match');
});
});
describe('finally', function() {
it('works with literal syntax', function() {
var actual = compiler.compile('var object = {\nfinally: null,\n};');
var expected = 'var object = {\n"finally": null,\n};'
astEqual(actual, expected, 'expected input.js and output.js to match');
});
it('works with member syntax', function() {
var actual = compiler.compile('object.finally(function(){\n\n});');
var expected = 'object["finally"](function(){\n\n});';
astEqual(actual, expected, 'expected input.js and output.js to match');
});
});
describe('default', function() {
it('works with literal syntax', function() {
var actual = compiler.compile('var object = {\ndefault: null,\n};');
var expected = 'var object = {\n"default": null,\n};'
astEqual(actual, expected, 'expected input.js and output.js to match');
});
it('works with member syntax', function() {
var actual = compiler.compile('object.default(function(){\n\n});');
var expected = 'object["default"](function(){\n\n});';
astEqual(actual, expected, 'expected input.js and output.js to match');
});
});
describe('new', function() {
it('works with literal syntax', function() {
var actual = compiler.compile('var object = {\nnew: null,\n};');
var expected = 'var object = {\n"new": null,\n};'
astEqual(actual, expected, 'expected input.js and output.js to match');
});
it('works with member syntax', function() {
var actual = compiler.compile('object.new(function(){\n\n});');
var expected = 'object["new"](function(){\n\n});';
astEqual(actual, expected, 'expected input.js and output.js to match');
});
});
describe('throw', function() {
it('works with literal syntax', function() {
var actual = compiler.compile('var object = {\nthrow: null,\n};');
var expected = 'var object = {\n"throw": null,\n};'
astEqual(actual, expected, 'expected input.js and output.js to match');
});
it('works with member syntax', function() {
var actual = compiler.compile('object.throw(function(){\n\n});');
var expected = 'object["throw"](function(){\n\n});';
astEqual(actual, expected, 'expected input.js and output.js to match');
});
});
describe('return', function() {
it('works with literal syntax', function() {
var actual = compiler.compile('var object = {\nreturn: null,\n};');
var expected = 'var object = {\n"return": null,\n};'
astEqual(actual, expected, 'expected input.js and output.js to match');
});
it('works with member syntax', function() {
var actual = compiler.compile('object.return(function(){\n\n});');
var expected = 'object["return"](function(){\n\n});';
astEqual(actual, expected, 'expected input.js and output.js to match');
});
});
describe('import', function() {
it('works with literal syntax', function() {
var actual = compiler.compile('var object = {\nimport: null,\n};');
var expected = 'var object = {\n"import": null,\n};'
astEqual(actual, expected, 'expected input.js and output.js to match');
});
it('works with member syntax', function() {
var actual = compiler.compile('object.import(function(){\n\n});');
var expected = 'object["import"](function(){\n\n});';
astEqual(actual, expected, 'expected input.js and output.js to match');
});
});
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