Socket
Socket
Sign inDemoInstall

react-is

Package Overview
Dependencies
0
Maintainers
7
Versions
1697
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 16.3.0-rc.0 to 16.3.0

9

cjs/react-is.development.js

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

/** @license React v16.3.0-rc.0
/** @license React v16.3.0
* react-is.development.js

@@ -35,2 +35,8 @@ *

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_STRICT_MODE_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE);
}
function typeOf(object) {

@@ -112,2 +118,3 @@ if (typeof object === 'object' && object !== null) {

exports.StrictMode = StrictMode;
exports.isValidElementType = isValidElementType;
exports.isAsyncMode = isAsyncMode;

@@ -114,0 +121,0 @@ exports.isContextConsumer = isContextConsumer;

7

cjs/react-is.production.min.js

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

/** @license React v16.3.0-rc.0
/** @license React v16.3.0
* react-is.production.min.js

@@ -11,3 +11,4 @@ *

'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,l=b?Symbol["for"]("react.forward_ref"):60112;
function m(a){if("object"===typeof a&&null!==a){var n=a.$$typeof;switch(n){case c:switch(a=a.type,a){case k:case e:case f:return a;default:switch(a=a&&a.$$typeof,a){case h:case l:case g:return a;default:return n}}case d:return n}}}exports.typeOf=m;exports.AsyncMode=k;exports.ContextConsumer=h;exports.ContextProvider=g;exports.Element=c;exports.ForwardRef=l;exports.Fragment=e;exports.Portal=d;exports.StrictMode=f;exports.isAsyncMode=function(a){return m(a)===k};
exports.isContextConsumer=function(a){return m(a)===h};exports.isContextProvider=function(a){return m(a)===g};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return m(a)===l};exports.isFragment=function(a){return m(a)===e};exports.isPortal=function(a){return m(a)===d};exports.isStrictMode=function(a){return m(a)===f};
function m(a){if("object"===typeof a&&null!==a){var n=a.$$typeof;switch(n){case c:switch(a=a.type,a){case k:case e:case f:return a;default:switch(a=a&&a.$$typeof,a){case h:case l:case g:return a;default:return n}}case d:return n}}}exports.typeOf=m;exports.AsyncMode=k;exports.ContextConsumer=h;exports.ContextProvider=g;exports.Element=c;exports.ForwardRef=l;exports.Fragment=e;exports.Portal=d;exports.StrictMode=f;
exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===k||a===f||"object"===typeof a&&null!==a&&(a.$$typeof===g||a.$$typeof===h||a.$$typeof===l)};exports.isAsyncMode=function(a){return m(a)===k};exports.isContextConsumer=function(a){return m(a)===h};exports.isContextProvider=function(a){return m(a)===g};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return m(a)===l};
exports.isFragment=function(a){return m(a)===e};exports.isPortal=function(a){return m(a)===d};exports.isStrictMode=function(a){return m(a)===f};
{
"name": "react-is",
"version": "16.3.0-rc.0",
"version": "16.3.0",
"description": "Brand checking of React Elements.",

@@ -5,0 +5,0 @@ "main": "index.js",

# `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.3.0-rc.0
/** @license React v16.3.0
* react-is.development.js

@@ -33,2 +33,8 @@ *

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_STRICT_MODE_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE);
}
function typeOf(object) {

@@ -110,2 +116,3 @@ if (typeof object === 'object' && object !== null) {

exports.StrictMode = StrictMode;
exports.isValidElementType = isValidElementType;
exports.isAsyncMode = isAsyncMode;

@@ -112,0 +119,0 @@ exports.isContextConsumer = isContextConsumer;

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

/** @license React v16.3.0-rc.0
/** @license React v16.3.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&&a.$$typeof,a){case k:case l:case m:return a;default:return b}}case n:return b}}}var d="function"===typeof Symbol&&Symbol["for"],e=d?Symbol["for"]("react.element"):
60103,n=d?Symbol["for"]("react.portal"):60106,g=d?Symbol["for"]("react.fragment"):60107,h=d?Symbol["for"]("react.strict_mode"):60108,m=d?Symbol["for"]("react.provider"):60109,k=d?Symbol["for"]("react.context"):60110,f=d?Symbol["for"]("react.async_mode"):60111,l=d?Symbol["for"]("react.forward_ref"):60112;b.typeOf=c;b.AsyncMode=f;b.ContextConsumer=k;b.ContextProvider=m;b.Element=e;b.ForwardRef=l;b.Fragment=g;b.Portal=n;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)===m};b.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===e};b.isForwardRef=function(a){return c(a)===l};b.isFragment=function(a){return c(a)===g};b.isPortal=function(a){return c(a)===n};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 m:switch(a=a.type,a){case e:case f:case g:return a;default:switch(a=a&&a.$$typeof,a){case h:case k:case l:return a;default:return b}}case n:return b}}}var d="function"===typeof Symbol&&Symbol["for"],m=d?Symbol["for"]("react.element"):
60103,n=d?Symbol["for"]("react.portal"):60106,f=d?Symbol["for"]("react.fragment"):60107,g=d?Symbol["for"]("react.strict_mode"):60108,l=d?Symbol["for"]("react.provider"):60109,h=d?Symbol["for"]("react.context"):60110,e=d?Symbol["for"]("react.async_mode"):60111,k=d?Symbol["for"]("react.forward_ref"):60112;b.typeOf=c;b.AsyncMode=e;b.ContextConsumer=h;b.ContextProvider=l;b.Element=m;b.ForwardRef=k;b.Fragment=f;b.Portal=n;b.StrictMode=g;b.isValidElementType=function(a){return"string"===typeof a||"function"===
typeof a||a===f||a===e||a===g||"object"===typeof a&&null!==a&&(a.$$typeof===l||a.$$typeof===h||a.$$typeof===k)};b.isAsyncMode=function(a){return c(a)===e};b.isContextConsumer=function(a){return c(a)===h};b.isContextProvider=function(a){return c(a)===l};b.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===m};b.isForwardRef=function(a){return c(a)===k};b.isFragment=function(a){return c(a)===f};b.isPortal=function(a){return c(a)===n};b.isStrictMode=function(a){return c(a)===g};Object.defineProperty(b,
"__esModule",{value:!0})});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc