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

babel-plugin-es5-array-autopolyfill

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-es5-array-autopolyfill - npm Package Compare versions

Comparing version 2.0.1 to 3.0.0

test/fixtures/do-nothing-on-non-arrays/.babelrc

26

lib/index.js

@@ -36,6 +36,14 @@ 'use strict';

var callee = path.node.callee;
if (!t.isMemberExpression(callee)) {
var identifierPath = path.get("callee.object", true);
if (!identifierPath.isNodeType("Identifier") && !identifierPath.isNodeType("TypeCastExpression")) {
return;
}
var property = callee.property;
var annotation = identifierPath.getTypeAnnotation();
if (!isArrayType(t, annotation)) {
return;
}
var property = path.get('callee.property').node;
if (t.isIdentifier(property) && replaceProperties.indexOf(property.name) >= 0) {

@@ -52,2 +60,14 @@ usedMethods[property.name] = true;

var replaceProperties = ['reduce', 'map', 'filter', 'forEach'];
var prefix = "es5";
var prefix = "es5";
function isArrayType(t, node) {
if (t.isArrayTypeAnnotation(node)) {
return true;
}
if (t.isGenericTypeAnnotation(node) && node.id.name === 'Array') {
return true;
}
return false;
}

4

package.json
{
"name": "babel-plugin-es5-array-autopolyfill",
"version": "2.0.1",
"version": "3.0.0",
"description": "",

@@ -16,2 +16,4 @@ "main": "lib/index.js",

"babel-eslint": "^4.1.6",
"babel-plugin-syntax-flow": "^6.5.0",
"babel-plugin-transform-flow-strip-types": "^6.7.0",
"babel-preset-es2015": "^6.1.18",

@@ -18,0 +20,0 @@ "babel-register": "^6.2.0",

@@ -14,2 +14,3 @@ import path from 'path';

fs.readdirSync(fixturesDir).map((caseName) => {
it(`should ${caseName.split('-').join(' ')}`, () => {

@@ -16,0 +17,0 @@ const fixtureDir = path.join(fixturesDir, caseName);

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