react-side-effect
Advanced tools
Comparing version 1.1.3 to 1.1.4
'use strict'; | ||
var _react = require('react'); | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var _react2 = _interopRequireDefault(_react); | ||
var React = require('react'); | ||
var React__default = _interopDefault(React); | ||
var ExecutionEnvironment = _interopDefault(require('exenv')); | ||
var shallowEqual = _interopDefault(require('shallowequal')); | ||
var _exenv = require('exenv'); | ||
var _exenv2 = _interopRequireDefault(_exenv); | ||
var _shallowequal = require('shallowequal'); | ||
var _shallowequal2 = _interopRequireDefault(_shallowequal); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -23,3 +16,3 @@ | ||
module.exports = function withSideEffect(reducePropsToState, handleStateChangeOnClient, mapStateOnServer) { | ||
function withSideEffect(reducePropsToState, handleStateChangeOnClient, mapStateOnServer) { | ||
if (typeof reducePropsToState !== 'function') { | ||
@@ -88,3 +81,3 @@ throw new Error('Expected reducePropsToState to be a function.'); | ||
SideEffect.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) { | ||
return !(0, _shallowequal2.default)(nextProps, this.props); | ||
return !shallowEqual(nextProps, this.props); | ||
}; | ||
@@ -108,10 +101,10 @@ | ||
SideEffect.prototype.render = function render() { | ||
return _react2.default.createElement(WrappedComponent, this.props); | ||
return React__default.createElement(WrappedComponent, this.props); | ||
}; | ||
return SideEffect; | ||
}(_react.Component); | ||
}(React.Component); | ||
SideEffect.displayName = 'SideEffect(' + getDisplayName(WrappedComponent) + ')'; | ||
SideEffect.canUseDOM = _exenv2.default.canUseDOM; | ||
SideEffect.canUseDOM = ExecutionEnvironment.canUseDOM; | ||
@@ -121,2 +114,4 @@ | ||
}; | ||
}; | ||
} | ||
module.exports = withSideEffect; |
{ | ||
"name": "react-side-effect", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "Create components whose prop changes map to a global side effect", | ||
"main": "lib/index.js", | ||
"module": "lib/index.es.js", | ||
"scripts": { | ||
"build": "babel src --out-dir lib", | ||
"build": "node scripts/build.js", | ||
"clean": "rimraf lib", | ||
@@ -33,2 +34,5 @@ "prepublish": "npm test && npm run clean && npm run build", | ||
], | ||
"peerDependencies": { | ||
"react": "^0.13.0 || ^0.14.0 || ^15.0.0 || ^16.0.0" | ||
}, | ||
"dependencies": { | ||
@@ -41,15 +45,24 @@ "exenv": "^1.2.1", | ||
"babel-core": "^6.21.0", | ||
"babel-preset-es2015": "^6.18.0", | ||
"babel-plugin-add-module-exports": "^0.2.1", | ||
"babel-plugin-transform-class-properties": "^6.24.1", | ||
"babel-plugin-transform-object-rest-spread": "^6.26.0", | ||
"babel-preset-env": "^1.6.0", | ||
"babel-preset-react": "^6.16.0", | ||
"babel-preset-stage-2": "^6.18.0", | ||
"babel-register": "^6.18.0", | ||
"chai": "^3.2.0", | ||
"enzyme": "^2.7.0", | ||
"gzip-size": "^4.1.0", | ||
"isparta": "^4.0.0", | ||
"jsdom": "^9.9.1", | ||
"mocha": "^3.2.0", | ||
"pretty-bytes": "^4.0.2", | ||
"react": "^15.4.2", | ||
"react-addons-test-utils": "^15.4.2", | ||
"react-dom": "^15.4.2", | ||
"rimraf": "^2.4.3" | ||
"rimraf": "^2.4.3", | ||
"rollup": "^0.56.2", | ||
"rollup-plugin-babel": "^3.0.2", | ||
"rollup-plugin-commonjs": "^8.3.0", | ||
"rollup-plugin-node-resolve": "^3.0.3", | ||
"rollup-plugin-uglify": "^3.0.0" | ||
}, | ||
@@ -56,0 +69,0 @@ "files": [ |
@@ -11,4 +11,18 @@ # React Side Effect [![Downloads](https://img.shields.io/npm/dm/react-side-effect.svg)](https://npmjs.com/react-side-effect) [![npm version](https://img.shields.io/npm/v/react-side-effect.svg?style=flat)](https://www.npmjs.com/package/react-side-effect) | ||
Note: React Side Effect requires React 0.13+. | ||
### As a script tag | ||
#### Development | ||
``` | ||
<script src="https://unpkg.com/react/umd/react.development.js" type="text/javascript"></script> | ||
<script src="https://unpkg.com/react-side-effect/lib/index.umd.js" type="text/javascript"></script> | ||
``` | ||
#### Production | ||
``` | ||
<script src="https://unpkg.com/react/umd/react.production.min.js" type="text/javascript"></script> | ||
<script src="https://unpkg.com/react-side-effect/lib/index.umd.min.js" type="text/javascript"></script> | ||
``` | ||
## Use Cases | ||
@@ -43,3 +57,4 @@ | ||
```js | ||
import { Component, Children, PropTypes } from 'react'; | ||
import { Component, Children } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import withSideEffect from 'react-side-effect'; | ||
@@ -94,3 +109,4 @@ | ||
```js | ||
import React, { Children, Component, PropTypes } from 'react'; | ||
import React, { Children, Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import withSideEffect from 'react-side-effect'; | ||
@@ -97,0 +113,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
25567
7
332
141
3
24
1
1