react-children-utilities
Advanced tools
Comparing version 1.0.9 to 1.0.10
@@ -1,3 +0,3 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _react=require("react");function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function _iterableToArray(iter){if(Symbol.iterator in Object(iter)||Object.prototype.toString.call(iter)==="[object Arguments]")return Array.from(iter)}function _arrayWithoutHoles(arr){if(Array.isArray(arr)){for(var i=0,arr2=new Array(arr.length);i<arr.length;i++){arr2[i]=arr[i]}return arr2}}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_defineProperty(target,key,source[key])})}return target}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}var hasChildren=function hasChildren(child){return Boolean(child&&child.props&&child.props.children)};var hasComplexChildren=function hasComplexChildren(child){return hasChildren(child)&&_typeof(child.props.children)==="object"};var _default=_objectSpread({},_react.Children,{filter:function filter(children,filterFn){return _react.Children.toArray(children).filter(filterFn)},deepFilter:function deepFilter(children,deepFilterFn){var _this=this;return _react.Children.toArray(children).filter(deepFilterFn).map(function(child){if(hasComplexChildren(child)){return(0,_react.cloneElement)(child,_objectSpread({},child.props,{children:_this.deepFilter(child.props.children,deepFilterFn)}))}return child})},groupByType:function groupByType(children,types,rest){return _react.Children.toArray(children).reduce(function(group,child){var isGrouped=types.includes(child.type);var addChild=isGrouped?child.props.children:child;var key=isGrouped?child.type:rest;return _objectSpread({},group,_defineProperty({},key,[].concat(_toConsumableArray(group[key]||[]),[addChild])))},{})},deepMap:function deepMap(children,deepMapFn){var _this2=this;return _react.Children.map(children,function(child){if(hasComplexChildren(child)){return deepMapFn((0,_react.cloneElement)(child,_objectSpread({},child.props,{children:_this2.deepMap(child.props.children,deepMapFn)})))}return deepMapFn(child)})},deepForEach:function deepForEach(children,deepForEachFn){var _this3=this;_react.Children.forEach(children,function(child){if(hasComplexChildren(child)){_this3.deepForEach(child.props.children,deepForEachFn)}deepForEachFn(child)})},deepFind:function deepFind(children,deepFindFn){var _this4=this;return _react.Children.toArray(children).find(function(child){if(hasComplexChildren(child)){return _this4.deepFind(child.props.children,deepFindFn)}return deepFindFn(child)})},onlyText:function onlyText(children){var _this5=this;return _react.Children.toArray(children).reduce(function(flattened,child){return[].concat(_toConsumableArray(flattened),[hasChildren(child)?_this5.onlyText(child.props.children):child])},[]).join("")}});exports.default=_default; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=void 0;var _react=require("react");function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function _iterableToArray(iter){if(Symbol.iterator in Object(iter)||Object.prototype.toString.call(iter)==="[object Arguments]")return Array.from(iter)}function _arrayWithoutHoles(arr){if(Array.isArray(arr)){for(var i=0,arr2=new Array(arr.length);i<arr.length;i++){arr2[i]=arr[i]}return arr2}}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_defineProperty(target,key,source[key])})}return target}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}var hasChildren=function hasChildren(child){return Boolean(child&&child.props&&child.props.children)};var hasComplexChildren=function hasComplexChildren(child){return hasChildren(child)&&_typeof(child.props.children)==="object"};var _default=_objectSpread({},_react.Children,{filter:function filter(children,filterFn){return _react.Children.toArray(children).filter(filterFn)},deepFilter:function deepFilter(children,deepFilterFn){var _this=this;return _react.Children.toArray(children).filter(deepFilterFn).map(function(child){if(hasComplexChildren(child)){return(0,_react.cloneElement)(child,_objectSpread({},child.props,{children:_this.deepFilter(child.props.children,deepFilterFn)}))}return child})},groupByType:function groupByType(children,types,rest){return _react.Children.toArray(children).reduce(function(group,child){var isGrouped=types.includes(child.type);var addChild=isGrouped?child.props.children:child;var key=isGrouped?child.type:rest;return _objectSpread({},group,_defineProperty({},key,[].concat(_toConsumableArray(group[key]||[]),[addChild])))},{})},deepMap:function deepMap(children,deepMapFn){var _this2=this;return _react.Children.map(children,function(child){if(hasComplexChildren(child)){return deepMapFn((0,_react.cloneElement)(child,_objectSpread({},child.props,{children:_this2.deepMap(child.props.children,deepMapFn)})))}return deepMapFn(child)})},deepForEach:function deepForEach(children,deepForEachFn){var _this3=this;_react.Children.forEach(children,function(child){if(hasComplexChildren(child)){_this3.deepForEach(child.props.children,deepForEachFn)}deepForEachFn(child)})},deepFind:function deepFind(children,deepFindFn){var _this4=this;return _react.Children.toArray(children).find(function(child){if(hasComplexChildren(child)){return _this4.deepFind(child.props.children,deepFindFn)}return deepFindFn(child)})},onlyText:function onlyText(children){var _this5=this;return _react.Children.toArray(children).reduce(function(flattened,child){return[].concat(_toConsumableArray(flattened),[hasChildren(child)?_this5.onlyText(child.props.children):child])},[]).join("")}});exports["default"]=_default; | ||
//# sourceMappingURL=index.js.map |
module.exports = { | ||
collectCoverageFrom: ['src/**/*.js'], | ||
setupFiles: [ | ||
require.resolve('raf/polyfill'), | ||
], | ||
testEnvironment: 'node', | ||
setupFilesAfterEnv: ['./node_modules/jest-enzyme/lib/index.js'], | ||
collectCoverageFrom: ['src/**/*.js', 'src/**/*.jsx'], | ||
testEnvironment: 'enzyme', | ||
transform: { | ||
'^.+\\.jsx?$': 'babel-jest', | ||
}, | ||
setupFilesAfterEnv: ['jest-enzyme'], | ||
}; |
{ | ||
"name": "react-children-utilities", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"description": "Extended utils for React.Children opaque data structure", | ||
@@ -40,42 +40,45 @@ "keywords": [ | ||
], | ||
"resolutions": { | ||
"axios": "^0.19.0" | ||
}, | ||
"peerDependencies": { | ||
"react": ">=15.0.0" | ||
"react": ">=15.x.x" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.2.3", | ||
"@babel/core": "^7.3.4", | ||
"@babel/preset-env": "^7.3.4", | ||
"@babel/cli": "^7.4.4", | ||
"@babel/core": "^7.4.5", | ||
"@babel/preset-env": "^7.4.5", | ||
"@babel/preset-flow": "^7.0.0", | ||
"@babel/preset-react": "^7.0.0", | ||
"@commitlint/cli": "^7.5.2", | ||
"@commitlint/config-conventional": "^7.5.0", | ||
"babel-core": "^7.0.0-0", | ||
"@commitlint/cli": "^7.6.1", | ||
"@commitlint/config-conventional": "^7.6.0", | ||
"babel-eslint": "^10.0.1", | ||
"babel-jest": "^24.1.0", | ||
"bundlesize": "^0.17.1", | ||
"codecov": "^3.2.0", | ||
"del-cli": "^1.1.0", | ||
"babel-jest": "^24.8.0", | ||
"bundlesize": "^0.17.2", | ||
"codecov": "^3.5.0", | ||
"del-cli": "^2.0.0", | ||
"enzyme": "^3.9.0", | ||
"enzyme-adapter-react-16": "^1.10.0", | ||
"eslint": "^5.15.0", | ||
"enzyme-adapter-react-16": "^1.13.2", | ||
"eslint": "^5.16.0", | ||
"eslint-config-airbnb": "^17.1.0", | ||
"eslint-plugin-flowtype": "^3.4.2", | ||
"eslint-plugin-import": "^2.16.0", | ||
"eslint-plugin-jest": "^22.3.0", | ||
"eslint-plugin-flowtype": "^3.9.1", | ||
"eslint-plugin-import": "^2.17.3", | ||
"eslint-plugin-jest": "^22.6.4", | ||
"eslint-plugin-jsx-a11y": "^6.2.1", | ||
"eslint-plugin-react": "^7.12.4", | ||
"flow-bin": "^0.94.0", | ||
"husky": "^1.3.1", | ||
"jest": "^24.1.0", | ||
"jest-enzyme": "^7.0.1", | ||
"jest-junit": "^6.3.0", | ||
"lint-staged": "^8.1.5", | ||
"eslint-plugin-react": "^7.13.0", | ||
"flow-bin": "^0.99.1", | ||
"husky": "^2.3.0", | ||
"jest": "^24.8.0", | ||
"jest-environment-enzyme": "^7.0.2", | ||
"jest-enzyme": "^7.0.2", | ||
"jest-junit": "^6.4.0", | ||
"lint-staged": "^8.1.7", | ||
"make-dir-cli": "^2.0.0", | ||
"prop-types": "^15.7.2", | ||
"raf": "^3.4.1", | ||
"react": "^16.8.3", | ||
"react-dom": "^16.8.3", | ||
"react-test-renderer": "^16.8.3" | ||
"react": "^16.8.4", | ||
"react-dom": "^16.8.6", | ||
"react-test-renderer": "^16.8.6" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
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
38278