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

babel-plugin-react-display-name

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-react-display-name - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

23

lib/index.js

@@ -29,2 +29,21 @@ "use strict";

var isCreateClassCallExpression = t.buildMatchMemberExpression("React.createClass");
function isCreateClass(node) {
if (!node || !t.isCallExpression(node)) return false;
// not React.createClass call member object
if (!isCreateClassCallExpression(node.callee)) return false;
// no call arguments
var args = node.arguments;
if (args.length !== 1) return false;
// first node arg is not an object
var first = args[0];
if (!t.isObjectExpression(first)) return false;
return true;
}
return new Plugin("react-display-name", {

@@ -37,3 +56,3 @@ metadata: {

ExportDefaultDeclaration: function ExportDefaultDeclaration(node, parent, scope, file) {
if (react.isCreateClass(node.declaration)) {
if (isCreateClass(node.declaration)) {
addDisplayName(file.opts.basename, node.declaration);

@@ -61,3 +80,3 @@ }

if (t.isIdentifier(left) && react.isCreateClass(right)) {
if (t.isIdentifier(left) && isCreateClass(right)) {
addDisplayName(left.name, right);

@@ -64,0 +83,0 @@ }

2

package.json
{
"name": "babel-plugin-react-display-name",
"version": "1.0.2",
"version": "1.0.3",
"description": "Add displayName to React.createClass calls",

@@ -5,0 +5,0 @@ "repository": "babel-plugins/babel-plugin-react-display-name",

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