Socket
Socket
Sign inDemoInstall

react-tree-walker

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-tree-walker - npm Package Compare versions

Comparing version 4.1.0 to 4.2.0

13

dist/react-tree-walker.js

@@ -167,3 +167,5 @@ 'use strict';

// In case the user doesn't pass these to super in the constructor
instance.props = instance.props || props;
Object.defineProperty(instance, 'props', {
value: instance.props || props
});
instance.context = instance.context || currentContext;

@@ -182,3 +184,10 @@ // set the instance state to null (not undefined) if not set, to match React behaviour

if (instance.componentWillMount) {
if (Component.getDerivedStateFromProps) {
var result = Component.getDerivedStateFromProps(instance.props, instance.state);
if (result !== null) {
instance.state = Object.assign({}, instance.state, result);
}
} else if (instance.UNSAFE_componentWillMount) {
instance.UNSAFE_componentWillMount();
} else if (instance.componentWillMount) {
instance.componentWillMount();

@@ -185,0 +194,0 @@ }

2

dist/react-tree-walker.min.js

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

"use strict";var defaultOptions={componentWillUnmount:!1},pReduce=function(e,n,t){return new Promise(function(r,o){var i=e[Symbol.iterator](),u=0;!function e(t){var c=i.next();c.done?r(t):Promise.all([t,c.value]).then(function(t){e(n(t[0],t[1],u++))}).catch(o)}(t)})},pMapSeries=function(e,n){var t=[];return pReduce(e,function(e,r,o){return Promise.resolve(n(r,o)).then(function(e){t.push(e)})}).then(function(){return t})},ensureChild=function e(n){return n&&"function"==typeof n.render?e(n.render()):n},getChildren=function(e){return e.props&&e.props.children?e.props.children:e.children?e.children:void 0},getType=function(e){return e.type||e.nodeName},getProps=function(e){return e.props||e.attributes},isReactElement=function(e){return!!getType(e)},isClassComponent=function(e){return e.prototype&&(e.prototype.render||e.prototype.isReactComponent||e.prototype.isPureReactComponent)},providesChildContext=function(e){return!!e.getChildContext};function reactTreeWalker(e,n,t){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:defaultOptions;return new Promise(function(o,i){var u=function(){try{return n.apply(void 0,arguments)}catch(e){i(e)}};(function e(n,t){if(Array.isArray(n))return Promise.all(n.map(function(n){return e(n,t)}));if(!n)return Promise.resolve();if("string"==typeof n||"number"==typeof n)return u(n,null,t),Promise.resolve();if(n.type&&(n.type._context&&(n.type._context._currentValue=n.props.value),n.type.Provider&&n.type.Consumer)){var o=n.props.children(n.type.Provider._context._currentValue);return e(o,t)}return isReactElement(n)?new Promise(function(o){var c=function(t,r,c,p){return Promise.resolve(u(n,r,c,p)).then(function(n){if(!1!==n){var r=t(),u=ensureChild(r);if(u)return Array.isArray(u)?pMapSeries(u,function(n){return n?e(n,p):Promise.resolve()}).then(o,i).catch(i):e(u,p).then(o,i).catch(i)}}).catch(i)};if("function"==typeof getType(n)){var p=getType(n),s=Object.assign({},p.defaultProps,getProps(n),{children:getChildren(n)});if(isClassComponent(p)){var l=new p(s,t);l.props=l.props||s,l.context=l.context||t,l.state=l.state||null,l.setState=function(e){"function"==typeof e&&(e=e(l.state,l.props,l.context)),l.state=Object.assign({},l.state,e)},l.componentWillMount&&l.componentWillMount();var a=providesChildContext(l)?Object.assign({},t,l.getChildContext()):t;c(function(){return l.render(l.props,l.state)},l,t,a).then(function(){r.componentWillUnmount&&l.componentWillUnmount&&l.componentWillUnmount()}).then(o)}else c(function(){return p(s,t)},null,t,t).then(o)}else c(function(){return getChildren(n)},null,t,t).then(o)}):n.containerInfo&&n.children&&n.children.props&&Array.isArray(n.children.props.children)?Promise.all(n.children.props.children.map(function(n){return e(n,t)})):Promise.resolve()})(e,t).then(o,i)})}module.exports=reactTreeWalker;
"use strict";var defaultOptions={componentWillUnmount:!1},pReduce=function(e,c,t){return new Promise(function(r,o){var i=e[Symbol.iterator](),u=0;!function t(e){var n=i.next();n.done?r(e):Promise.all([e,n.value]).then(function(e){t(c(e[0],e[1],u++))}).catch(o)}(t)})},pMapSeries=function(e,r){var o=[];return pReduce(e,function(e,t,n){return Promise.resolve(r(t,n)).then(function(e){o.push(e)})}).then(function(){return o})},ensureChild=function e(t){return t&&"function"==typeof t.render?e(t.render()):t},getChildren=function(e){return e.props&&e.props.children?e.props.children:e.children?e.children:void 0},getType=function(e){return e.type||e.nodeName},getProps=function(e){return e.props||e.attributes},isReactElement=function(e){return!!getType(e)},isClassComponent=function(e){return e.prototype&&(e.prototype.render||e.prototype.isReactComponent||e.prototype.isPureReactComponent)},providesChildContext=function(e){return!!e.getChildContext};function reactTreeWalker(t,n,r){var f=3<arguments.length&&void 0!==arguments[3]?arguments[3]:defaultOptions;return new Promise(function(e,l){var a=function(){try{return n.apply(void 0,arguments)}catch(e){l(e)}};(function c(p,s){if(Array.isArray(p))return Promise.all(p.map(function(e){return c(e,s)}));if(!p)return Promise.resolve();if("string"==typeof p||"number"==typeof p)return a(p,null,s),Promise.resolve();if(p.type&&(p.type._context&&(p.type._context._currentValue=p.props.value),p.type.Provider&&p.type.Consumer)){var e=p.props.children(p.type.Provider._context._currentValue);return c(e,s)}return isReactElement(p)?new Promise(function(i){var e=function(r,e,t,o){return Promise.resolve(a(p,e,t,o)).then(function(e){if(!1!==e){var t=r(),n=ensureChild(t);if(n)return Array.isArray(n)?pMapSeries(n,function(e){return e?c(e,o):Promise.resolve()}).then(i,l).catch(l):c(n,o).then(i,l).catch(l)}}).catch(l)};if("function"==typeof getType(p)){var t=getType(p),n=Object.assign({},t.defaultProps,getProps(p),{children:getChildren(p)});if(isClassComponent(t)){var r=new t(n,s);if(Object.defineProperty(r,"props",{value:r.props||n}),r.context=r.context||s,r.state=r.state||null,r.setState=function(e){"function"==typeof e&&(e=e(r.state,r.props,r.context)),r.state=Object.assign({},r.state,e)},t.getDerivedStateFromProps){var o=t.getDerivedStateFromProps(r.props,r.state);null!==o&&(r.state=Object.assign({},r.state,o))}else r.UNSAFE_componentWillMount?r.UNSAFE_componentWillMount():r.componentWillMount&&r.componentWillMount();var u=providesChildContext(r)?Object.assign({},s,r.getChildContext()):s;e(function(){return r.render(r.props,r.state)},r,s,u).then(function(){f.componentWillUnmount&&r.componentWillUnmount&&r.componentWillUnmount()}).then(i)}else e(function(){return t(n,s)},null,s,s).then(i)}else e(function(){return getChildren(p)},null,s,s).then(i)}):p.containerInfo&&p.children&&p.children.props&&Array.isArray(p.children.props.children)?Promise.all(p.children.props.children.map(function(e){return c(e,s)})):Promise.resolve()})(t,r).then(e,l)})}module.exports=reactTreeWalker;
//# sourceMappingURL=react-tree-walker.min.js.map
{
"name": "react-tree-walker",
"version": "4.1.0",
"description":
"Walk a React element tree, executing a provided function against each node.",
"version": "4.2.0",
"description": "Walk a React element tree, executing a provided function against each node.",
"license": "MIT",
"main": "dist/react-tree-walker.js",
"files": ["*.js", "*.md", "dist"],
"files": [
"*.js",
"*.md",
"dist"
],
"repository": {

@@ -15,3 +18,9 @@ "type": "git",

"author": "Sean Matheson <sean@ctrlplusb.com>",
"keywords": ["react", "react-element", "util", "tree", "visitor"],
"keywords": [
"react",
"react-element",
"util",
"tree",
"visitor"
],
"scripts": {

@@ -33,9 +42,9 @@ "build": "node ./tools/scripts/build.js",

"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-eslint": "^8.0.1",
"babel-jest": "^21.2.0",
"babel-loader": "^7.1.2",
"babel-core": "^6.26.3",
"babel-eslint": "^8.2.5",
"babel-jest": "^23.2.0",
"babel-loader": "^7.1.5",
"babel-plugin-external-helpers": "^6.22.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.0",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "6.24.1",

@@ -45,35 +54,41 @@ "babel-preset-stage-3": "6.24.1",

"change-case": "^3.0.2",
"codecov": "^2.3.0",
"cross-env": "^5.0.5",
"codecov": "^3.0.4",
"cross-env": "^5.2.0",
"enzyme": "^3.1.0",
"enzyme-to-json": "^3.1.2",
"eslint": "^4.8.0",
"enzyme-to-json": "^3.3.4",
"eslint": "^4.19.1",
"eslint-config-airbnb": "^16.0.0",
"eslint-config-prettier": "^2.6.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.4.0",
"gzip-size": "^4.0.0",
"eslint-plugin-import": "^2.13.0",
"eslint-plugin-jsx-a11y": "^6.1.0",
"eslint-plugin-react": "^7.10.0",
"gzip-size": "^5.0.0",
"husky": "^0.14.3",
"in-publish": "2.0.0",
"jest": "^21.2.1",
"lint-staged": "^4.2.3",
"preact": "^8.2.7",
"prettier": "^1.7.4",
"pretty-bytes": "4.0.2",
"prop-types": "^15.6.0",
"jest": "^23.3.0",
"lint-staged": "^7.2.0",
"preact": "^8.2.9",
"prettier": "^1.13.7",
"pretty-bytes": "5.1.0",
"prop-types": "^15.6.2",
"ramda": "^0.25.0",
"react": "^16.4.0",
"react": "^16.4.1",
"react-addons-test-utils": "^15.6.2",
"react-dom": "^16.0.0",
"readline-sync": "1.4.7",
"react-dom": "^16.4.1",
"readline-sync": "1.4.9",
"rimraf": "^2.6.2",
"rollup": "^0.56.5",
"rollup-plugin-babel": "^3.0.3",
"rollup-plugin-uglify": "^3.0.0"
"rollup": "^0.62.0",
"rollup-plugin-babel": "^3.0.7",
"rollup-plugin-uglify": "^4.0.0"
},
"jest": {
"collectCoverageFrom": ["src/**/*.{js,jsx}"],
"snapshotSerializers": ["<rootDir>/node_modules/enzyme-to-json/serializer"],
"testPathIgnorePatterns": ["<rootDir>/(coverage|dist|node_modules|tools)/"]
"collectCoverageFrom": [
"src/**/*.{js,jsx}"
],
"snapshotSerializers": [
"<rootDir>/node_modules/enzyme-to-json/serializer"
],
"testPathIgnorePatterns": [
"<rootDir>/(coverage|dist|node_modules|tools)/"
]
},

@@ -89,3 +104,6 @@ "eslintConfig": {

},
"extends": ["airbnb", "prettier"],
"extends": [
"airbnb",
"prettier"
],
"rules": {

@@ -99,3 +117,6 @@ "camelcase": 0,

"react/react-in-jsx-scope": 0,
"semi": [2, "never"],
"semi": [
2,
"never"
],
"react/forbid-prop-types": 0,

@@ -106,3 +127,7 @@ "react/jsx-filename-extension": 0,

},
"eslintIgnore": ["node_modules/", "dist/", "coverage/"],
"eslintIgnore": [
"node_modules/",
"dist/",
"coverage/"
],
"prettier": {

@@ -114,4 +139,7 @@ "semi": false,

"lint-staged": {
"*.js": ["prettier --write \"src/**/*.js\"", "git add"]
"*.js": [
"prettier --write \"src/**/*.js\"",
"git add"
]
}
}

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

const uglify = require('rollup-plugin-uglify')
const { uglify } = require('rollup-plugin-uglify')
const packageJson = require('./package.json')

@@ -3,0 +3,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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