pure-render-decorator
Advanced tools
Comparing version 0.1.0 to 0.2.0
23
index.js
@@ -7,4 +7,3 @@ /** | ||
var React = require('react/addons'); | ||
var PureRenderMixin = React.addons.PureRenderMixin; | ||
var shallowCompare = require('react-addons-shallow-compare'); | ||
@@ -14,9 +13,19 @@ | ||
/** | ||
* Makes the given component "pure" using the PureRenderMixin. | ||
* Tells if a component should update given it's next props | ||
* and state. | ||
* | ||
* @param object nextProps Next props. | ||
* @param object nextState Next state. | ||
*/ | ||
function shouldComponentUpdate(nextProps, nextState) { | ||
return shallowCompare(this, nextProps, nextState); | ||
} | ||
/** | ||
* Makes the given component "pure". | ||
* | ||
* @param object component Component. | ||
*/ | ||
function purify(component) { | ||
component.prototype.shouldComponentUpdate | ||
= PureRenderMixin.shouldComponentUpdate; | ||
function pureRenderDecorator(component) { | ||
component.prototype.shouldComponentUpdate = shouldComponentUpdate; | ||
} | ||
@@ -26,2 +35,2 @@ | ||
module.exports = purify; | ||
module.exports = pureRenderDecorator; |
{ | ||
"name": "pure-render-decorator", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Makes React components pure.", | ||
@@ -13,7 +13,16 @@ "keywords": [ | ||
"license": "MIT", | ||
"repository" : "felixgirault/pure-render-decorator", | ||
"repository": "felixgirault/pure-render-decorator", | ||
"main": "index.js", | ||
"peerDependencies": { | ||
"react": "*" | ||
"react": "^0.14.0" | ||
}, | ||
"dependencies": { | ||
"react-addons-shallow-compare": "^0.14.0" | ||
}, | ||
"devDependencies": { | ||
"mocha": "^2.3.3" | ||
}, | ||
"scripts": { | ||
"test": "mocha" | ||
} | ||
} |
@@ -32,3 +32,3 @@ Pure render decorator | ||
var React = require('react'); | ||
var PureRenderMixin = React.addons.PureRenderMixin; | ||
var PureRenderMixin = require('react-addons-pure-render-mixin'); | ||
@@ -35,0 +35,0 @@ var Test = React.createClass({ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4022
6
70
2
1
+ Addedacorn@5.7.4(transitive)
+ Addedamdefine@1.0.1(transitive)
+ Addedasap@2.0.6(transitive)
+ Addedast-types@0.9.6(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbase62@1.2.8(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addedcommoner@0.10.8(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedcore-js@1.2.7(transitive)
+ Addeddefined@1.0.1(transitive)
+ Addeddetective@4.7.1(transitive)
+ Addedenvify@3.4.1(transitive)
+ Addedesprima@3.1.3(transitive)
+ Addedesprima-fb@15001.1.0-dev-harmony-fb(transitive)
+ Addedfbjs@0.6.1(transitive)
+ Addedglob@5.0.15(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addediconv-lite@0.4.24(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedjstransform@11.0.3(transitive)
+ Addedloose-envify@1.4.0(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addedobject-assign@2.1.1(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedprivate@0.1.8(transitive)
+ Addedpromise@7.3.1(transitive)
+ Addedq@1.5.1(transitive)
+ Addedreact@0.14.10(transitive)
+ Addedreact-addons-shallow-compare@0.14.8(transitive)
+ Addedrecast@0.11.23(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsource-map@0.4.40.5.7(transitive)
+ Addedthrough@2.3.8(transitive)
+ Addedua-parser-js@0.7.40(transitive)
+ Addedwhatwg-fetch@0.9.0(transitive)
+ Addedwrappy@1.0.2(transitive)
- Removedreact@19.0.0(transitive)