Socket
Socket
Sign inDemoInstall

react-is

Package Overview
Dependencies
Maintainers
7
Versions
1833
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-is - npm Package Compare versions

Comparing version 16.4.0-alpha.0911da3 to 16.4.0

44

cjs/react-is.development.js

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

/** @license React v16.4.0-alpha.0911da3
/** @license React v16.4.0
* react-is.development.js

@@ -22,14 +22,21 @@ *

// nor polyfill, then a plain number is used for performance.
var hasSymbol = typeof Symbol === 'function' && Symbol['for'];
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol['for']('react.element') : 0xeac7;
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
var REACT_TIMEOUT_TYPE = hasSymbol ? Symbol.for('react.timeout') : 0xead1;
function isValidElementType(type) {
return typeof type === 'string' || typeof type === 'function' ||
// Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
type === REACT_FRAGMENT_TYPE || type === REACT_ASYNC_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_TIMEOUT_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE);
}
var REACT_PORTAL_TYPE = hasSymbol ? Symbol['for']('react.portal') : 0xeaca;
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol['for']('react.fragment') : 0xeacb;
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol['for']('react.strict_mode') : 0xeacc;
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol['for']('react.provider') : 0xeacd;
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol['for']('react.context') : 0xeace;
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol['for']('react.async_mode') : 0xeacf;
function typeOf(object) {

@@ -46,9 +53,11 @@ if (typeof object === 'object' && object !== null) {

case REACT_FRAGMENT_TYPE:
case REACT_PROFILER_TYPE:
case REACT_STRICT_MODE_TYPE:
return type;
default:
var $$typeofType = type.$$typeof;
var $$typeofType = type && type.$$typeof;
switch ($$typeofType) {
case REACT_CONTEXT_TYPE:
case REACT_FORWARD_REF_TYPE:
case REACT_PROVIDER_TYPE:

@@ -72,3 +81,5 @@ return $$typeofType;

var Element = REACT_ELEMENT_TYPE;
var ForwardRef = REACT_FORWARD_REF_TYPE;
var Fragment = REACT_FRAGMENT_TYPE;
var Profiler = REACT_PROFILER_TYPE;
var Portal = REACT_PORTAL_TYPE;

@@ -89,5 +100,11 @@ var StrictMode = REACT_STRICT_MODE_TYPE;

}
function isForwardRef(object) {
return typeOf(object) === REACT_FORWARD_REF_TYPE;
}
function isFragment(object) {
return typeOf(object) === REACT_FRAGMENT_TYPE;
}
function isProfiler(object) {
return typeOf(object) === REACT_PROFILER_TYPE;
}
function isPortal(object) {

@@ -105,5 +122,8 @@ return typeOf(object) === REACT_PORTAL_TYPE;

exports.Element = Element;
exports.ForwardRef = ForwardRef;
exports.Fragment = Fragment;
exports.Profiler = Profiler;
exports.Portal = Portal;
exports.StrictMode = StrictMode;
exports.isValidElementType = isValidElementType;
exports.isAsyncMode = isAsyncMode;

@@ -113,3 +133,5 @@ exports.isContextConsumer = isContextConsumer;

exports.isElement = isElement;
exports.isForwardRef = isForwardRef;
exports.isFragment = isFragment;
exports.isProfiler = isProfiler;
exports.isPortal = isPortal;

@@ -116,0 +138,0 @@ exports.isStrictMode = isStrictMode;

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

/** @license React v16.4.0-alpha.0911da3
/** @license React v16.4.0
* react-is.production.min.js

@@ -10,4 +10,5 @@ *

'use strict';Object.defineProperty(exports,"__esModule",{value:!0});var b="function"===typeof Symbol&&Symbol["for"],c=b?Symbol["for"]("react.element"):60103,d=b?Symbol["for"]("react.portal"):60106,e=b?Symbol["for"]("react.fragment"):60107,f=b?Symbol["for"]("react.strict_mode"):60108,g=b?Symbol["for"]("react.provider"):60109,h=b?Symbol["for"]("react.context"):60110,k=b?Symbol["for"]("react.async_mode"):60111;
function l(a){if("object"===typeof a&&null!==a){var m=a.$$typeof;switch(m){case c:switch(a=a.type,a){case k:case e:case f:return a;default:switch(a=a.$$typeof,a){case h:case g:return a;default:return m}}case d:return m}}}exports.typeOf=l;exports.AsyncMode=k;exports.ContextConsumer=h;exports.ContextProvider=g;exports.Element=c;exports.Fragment=e;exports.Portal=d;exports.StrictMode=f;exports.isAsyncMode=function(a){return l(a)===k};exports.isContextConsumer=function(a){return l(a)===h};
exports.isContextProvider=function(a){return l(a)===g};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isFragment=function(a){return l(a)===e};exports.isPortal=function(a){return l(a)===d};exports.isStrictMode=function(a){return l(a)===f};
'use strict';Object.defineProperty(exports,"__esModule",{value:!0});var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.forward_ref"):60112,n=b?Symbol.for("react.timeout"):60113;
function q(a){if("object"===typeof a&&null!==a){var p=a.$$typeof;switch(p){case c:switch(a=a.type,a){case l:case e:case g:case f:return a;default:switch(a=a&&a.$$typeof,a){case k:case m:case h:return a;default:return p}}case d:return p}}}exports.typeOf=q;exports.AsyncMode=l;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=m;exports.Fragment=e;exports.Profiler=g;exports.Portal=d;exports.StrictMode=f;
exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===l||a===g||a===f||a===n||"object"===typeof a&&null!==a&&(a.$$typeof===h||a.$$typeof===k||a.$$typeof===m)};exports.isAsyncMode=function(a){return q(a)===l};exports.isContextConsumer=function(a){return q(a)===k};exports.isContextProvider=function(a){return q(a)===h};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return q(a)===m};
exports.isFragment=function(a){return q(a)===e};exports.isProfiler=function(a){return q(a)===g};exports.isPortal=function(a){return q(a)===d};exports.isStrictMode=function(a){return q(a)===f};
{
"name": "react-is",
"version": "16.4.0-alpha.0911da3",
"version": "16.4.0",
"description": "Brand checking of React Elements.",

@@ -15,5 +15,2 @@ "main": "index.js",

"homepage": "https://reactjs.org/",
"peerDependencies": {
"react": "^16.0.0 || 16.4.0-alpha.0911da3"
},
"files": [

@@ -20,0 +17,0 @@ "LICENSE",

# `react-is`
This package allows you to test arbitrary values and see if they're a particular React type, e.g. React Elements.
This package allows you to test arbitrary values and see if they're a particular React element type.

@@ -17,5 +17,35 @@ ## Installation

### AsyncMode
### Determining if a Component is Valid
```js
import * as ReactIs from "react-is";
class ClassComponent extends React.Component {
render() {
return React.createElement("div");
}
}
const StatelessComponent = () => React.createElement("div");
const ForwardRefComponent = React.forwardRef((props, ref) =>
React.createElement(Component, { forwardedRef: ref, ...props })
);
const Context = React.createContext(false);
ReactIs.isValidElementType("div"); // true
ReactIs.isValidElementType(ClassComponent); // true
ReactIs.isValidElementType(StatelessComponent); // true
ReactIs.isValidElementType(ForwardRefComponent); // true
ReactIs.isValidElementType(Context.Provider); // true
ReactIs.isValidElementType(Context.Consumer); // true
ReactIs.isValidElementType(React.createFactory("div")); // true
```
### Determining an Element's Type
#### AsyncMode
```js
import React from "react";

@@ -28,3 +58,3 @@ import * as ReactIs from 'react-is';

### Context
#### Context

@@ -43,3 +73,3 @@ ```js

### Element
#### Element

@@ -54,3 +84,3 @@ ```js

### Fragment
#### Fragment

@@ -65,3 +95,3 @@ ```js

### Portal
#### Portal

@@ -80,3 +110,3 @@ ```js

### StrictMode
#### StrictMode

@@ -83,0 +113,0 @@ ```js

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

/** @license React v16.4.0-alpha.0911da3
/** @license React v16.4.0
* react-is.development.js

@@ -20,14 +20,21 @@ *

// nor polyfill, then a plain number is used for performance.
var hasSymbol = typeof Symbol === 'function' && Symbol['for'];
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol['for']('react.element') : 0xeac7;
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
var REACT_TIMEOUT_TYPE = hasSymbol ? Symbol.for('react.timeout') : 0xead1;
function isValidElementType(type) {
return typeof type === 'string' || typeof type === 'function' ||
// Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
type === REACT_FRAGMENT_TYPE || type === REACT_ASYNC_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_TIMEOUT_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE);
}
var REACT_PORTAL_TYPE = hasSymbol ? Symbol['for']('react.portal') : 0xeaca;
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol['for']('react.fragment') : 0xeacb;
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol['for']('react.strict_mode') : 0xeacc;
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol['for']('react.provider') : 0xeacd;
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol['for']('react.context') : 0xeace;
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol['for']('react.async_mode') : 0xeacf;
function typeOf(object) {

@@ -44,9 +51,11 @@ if (typeof object === 'object' && object !== null) {

case REACT_FRAGMENT_TYPE:
case REACT_PROFILER_TYPE:
case REACT_STRICT_MODE_TYPE:
return type;
default:
var $$typeofType = type.$$typeof;
var $$typeofType = type && type.$$typeof;
switch ($$typeofType) {
case REACT_CONTEXT_TYPE:
case REACT_FORWARD_REF_TYPE:
case REACT_PROVIDER_TYPE:

@@ -70,3 +79,5 @@ return $$typeofType;

var Element = REACT_ELEMENT_TYPE;
var ForwardRef = REACT_FORWARD_REF_TYPE;
var Fragment = REACT_FRAGMENT_TYPE;
var Profiler = REACT_PROFILER_TYPE;
var Portal = REACT_PORTAL_TYPE;

@@ -87,5 +98,11 @@ var StrictMode = REACT_STRICT_MODE_TYPE;

}
function isForwardRef(object) {
return typeOf(object) === REACT_FORWARD_REF_TYPE;
}
function isFragment(object) {
return typeOf(object) === REACT_FRAGMENT_TYPE;
}
function isProfiler(object) {
return typeOf(object) === REACT_PROFILER_TYPE;
}
function isPortal(object) {

@@ -103,5 +120,8 @@ return typeOf(object) === REACT_PORTAL_TYPE;

exports.Element = Element;
exports.ForwardRef = ForwardRef;
exports.Fragment = Fragment;
exports.Profiler = Profiler;
exports.Portal = Portal;
exports.StrictMode = StrictMode;
exports.isValidElementType = isValidElementType;
exports.isAsyncMode = isAsyncMode;

@@ -111,3 +131,5 @@ exports.isContextConsumer = isContextConsumer;

exports.isElement = isElement;
exports.isForwardRef = isForwardRef;
exports.isFragment = isFragment;
exports.isProfiler = isProfiler;
exports.isPortal = isPortal;

@@ -114,0 +136,0 @@ exports.isStrictMode = isStrictMode;

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

/** @license React v16.4.0-alpha.0911da3
/** @license React v16.4.0
* react-is.production.min.js

@@ -9,4 +9,5 @@ *

*/
'use strict';(function(b,c){"object"===typeof exports&&"undefined"!==typeof module?c(exports):"function"===typeof define&&define.amd?define(["exports"],c):c(b.ReactIs={})})(this,function(b){function c(a){if("object"===typeof a&&null!==a){var b=a.$$typeof;switch(b){case e:switch(a=a.type,a){case f:case g:case h:return a;default:switch(a=a.$$typeof,a){case k:case l:return a;default:return b}}case m:return b}}}var d="function"===typeof Symbol&&Symbol["for"],e=d?Symbol["for"]("react.element"):60103,m=
d?Symbol["for"]("react.portal"):60106,g=d?Symbol["for"]("react.fragment"):60107,h=d?Symbol["for"]("react.strict_mode"):60108,l=d?Symbol["for"]("react.provider"):60109,k=d?Symbol["for"]("react.context"):60110,f=d?Symbol["for"]("react.async_mode"):60111;b.typeOf=c;b.AsyncMode=f;b.ContextConsumer=k;b.ContextProvider=l;b.Element=e;b.Fragment=g;b.Portal=m;b.StrictMode=h;b.isAsyncMode=function(a){return c(a)===f};b.isContextConsumer=function(a){return c(a)===k};b.isContextProvider=function(a){return c(a)===
l};b.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===e};b.isFragment=function(a){return c(a)===g};b.isPortal=function(a){return c(a)===m};b.isStrictMode=function(a){return c(a)===h};Object.defineProperty(b,"__esModule",{value:!0})});
'use strict';(function(b,c){"object"===typeof exports&&"undefined"!==typeof module?c(exports):"function"===typeof define&&define.amd?define(["exports"],c):c(b.ReactIs={})})(this,function(b){function c(a){if("object"===typeof a&&null!==a){var b=a.$$typeof;switch(b){case n:switch(a=a.type,a){case e:case f:case g:case h:return a;default:switch(a=a&&a.$$typeof,a){case k:case l:case m:return a;default:return b}}case p:return b}}}var d="function"===typeof Symbol&&Symbol.for,n=d?Symbol.for("react.element"):
60103,p=d?Symbol.for("react.portal"):60106,f=d?Symbol.for("react.fragment"):60107,h=d?Symbol.for("react.strict_mode"):60108,g=d?Symbol.for("react.profiler"):60114,m=d?Symbol.for("react.provider"):60109,k=d?Symbol.for("react.context"):60110,e=d?Symbol.for("react.async_mode"):60111,l=d?Symbol.for("react.forward_ref"):60112,q=d?Symbol.for("react.timeout"):60113;b.typeOf=c;b.AsyncMode=e;b.ContextConsumer=k;b.ContextProvider=m;b.Element=n;b.ForwardRef=l;b.Fragment=f;b.Profiler=g;b.Portal=p;b.StrictMode=
h;b.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===f||a===e||a===g||a===h||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===m||a.$$typeof===k||a.$$typeof===l)};b.isAsyncMode=function(a){return c(a)===e};b.isContextConsumer=function(a){return c(a)===k};b.isContextProvider=function(a){return c(a)===m};b.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===n};b.isForwardRef=function(a){return c(a)===l};b.isFragment=function(a){return c(a)===
f};b.isProfiler=function(a){return c(a)===g};b.isPortal=function(a){return c(a)===p};b.isStrictMode=function(a){return c(a)===h};Object.defineProperty(b,"__esModule",{value:!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