Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-children-utilities

Package Overview
Dependencies
Maintainers
1
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-children-utilities - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

2

dist/index.js

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

"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=exports.onlyText=exports.deepFind=exports.deepForEach=exports.deepMap=exports.groupByType=exports.deepFilter=exports.filter=exports.hasComplexChildren=exports.hasChildren=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)};exports.hasChildren=hasChildren;var hasComplexChildren=function hasComplexChildren(child){return hasChildren(child)&&_typeof(child.props.children)==="object"};exports.hasComplexChildren=hasComplexChildren;var filter=function filter(children,filterFn){return _react.Children.toArray(children).filter(filterFn)};exports.filter=filter;var deepFilter=function deepFilter(children,deepFilterFn){return _react.Children.toArray(children).filter(deepFilterFn).map(function(child){if(hasComplexChildren(child)){return(0,_react.cloneElement)(child,_objectSpread({},child.props,{children:deepFilter(child.props.children,deepFilterFn)}))}return child})};exports.deepFilter=deepFilter;var 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])))},{})};exports.groupByType=groupByType;var deepMap=function deepMap(children,deepMapFn){return _react.Children.map(children,function(child){if(hasComplexChildren(child)){return deepMapFn((0,_react.cloneElement)(child,_objectSpread({},child.props,{children:deepMap(child.props.children,deepMapFn)})))}return deepMapFn(child)})};exports.deepMap=deepMap;var deepForEach=function deepForEach(children,deepForEachFn){_react.Children.forEach(children,function(child){if(hasComplexChildren(child)){deepForEach(child.props.children,deepForEachFn)}deepForEachFn(child)})};exports.deepForEach=deepForEach;var deepFind=function deepFind(children,deepFindFn){return _react.Children.toArray(children).find(function(child){if(hasComplexChildren(child)){return deepFind(child.props.children,deepFindFn)}return deepFindFn(child)})};exports.deepFind=deepFind;var onlyText=function onlyText(children){return _react.Children.toArray(children).reduce(function(flattened,child){return[].concat(_toConsumableArray(flattened),[hasChildren(child)?onlyText(child.props.children):child])},[]).join("")};exports.onlyText=onlyText;var _default=_objectSpread({},_react.Children,{filter:filter,deepFilter:deepFilter,groupByType:groupByType,deepMap:deepMap,deepForEach:deepForEach,deepFind:deepFind,onlyText:onlyText,hasChildren:hasChildren,hasComplexChildren:hasComplexChildren});exports["default"]=_default;
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=exports.onlyText=exports.deepFind=exports.deepForEach=exports.deepMap=exports.groupByType=exports.deepFilter=exports.filter=exports.hasComplexChildren=exports.hasChildren=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 ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){keys.push.apply(keys,Object.getOwnPropertySymbols(object))}if(enumerableOnly)keys=keys.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable});return keys}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(source,true).forEach(function(key){_defineProperty(target,key,source[key])})}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(source).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(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)};exports.hasChildren=hasChildren;var hasComplexChildren=function hasComplexChildren(child){return hasChildren(child)&&_typeof(child.props.children)==="object"};exports.hasComplexChildren=hasComplexChildren;var filter=function filter(children,filterFn){return _react.Children.toArray(children).filter(filterFn)};exports.filter=filter;var deepFilter=function deepFilter(children,deepFilterFn){return _react.Children.toArray(children).filter(deepFilterFn).map(function(child){if(hasComplexChildren(child)){return(0,_react.cloneElement)(child,_objectSpread({},child.props,{children:deepFilter(child.props.children,deepFilterFn)}))}return child})};exports.deepFilter=deepFilter;var 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])))},{})};exports.groupByType=groupByType;var deepMap=function deepMap(children,deepMapFn){return _react.Children.map(children,function(child){if(hasComplexChildren(child)){return deepMapFn((0,_react.cloneElement)(child,_objectSpread({},child.props,{children:deepMap(child.props.children,deepMapFn)})))}return deepMapFn(child)})};exports.deepMap=deepMap;var deepForEach=function deepForEach(children,deepForEachFn){_react.Children.forEach(children,function(child){if(hasComplexChildren(child)){deepForEach(child.props.children,deepForEachFn)}deepForEachFn(child)})};exports.deepForEach=deepForEach;var deepFind=function deepFind(children,deepFindFn){return _react.Children.toArray(children).find(function(child){if(hasComplexChildren(child)){return deepFind(child.props.children,deepFindFn)}return deepFindFn(child)})};exports.deepFind=deepFind;var onlyText=function onlyText(children){return _react.Children.toArray(children).reduce(function(flattened,child){return[].concat(_toConsumableArray(flattened),[hasChildren(child)?onlyText(child.props.children):child])},[]).join("")};exports.onlyText=onlyText;var _default=_objectSpread({},_react.Children,{filter:filter,deepFilter:deepFilter,groupByType:groupByType,deepMap:deepMap,deepForEach:deepForEach,deepFind:deepFind,onlyText:onlyText,hasChildren:hasChildren,hasComplexChildren:hasComplexChildren});exports["default"]=_default;
//# sourceMappingURL=index.js.map
{
"name": "react-children-utilities",
"version": "1.2.1",
"version": "1.2.2",
"description": "Extended utils for React.Children opaque data structure",

@@ -37,3 +37,3 @@ "keywords": [

"path": "dist/index.js",
"maxSize": "1.3 kB"
"maxSize": "1.4 kB"
}

@@ -45,9 +45,9 @@ ],

"peerDependencies": {
"react": ">=15.x.x"
"react": "15.x.x && 16.x.x"
},
"dependencies": {},
"devDependencies": {
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.5",
"@babel/preset-env": "^7.4.5",
"@babel/cli": "^7.5.0",
"@babel/core": "^7.5.4",
"@babel/preset-env": "^7.5.4",
"@babel/preset-react": "^7.0.0",

@@ -58,3 +58,3 @@ "@commitlint/cli": "^8.0.0",

"babel-jest": "^24.8.0",
"bundlesize": "^0.17.2",
"bundlesize": "^0.18.0",
"codecov": "^3.5.0",

@@ -64,10 +64,10 @@ "del-cli": "^2.0.0",

"enzyme-adapter-react-16": "^1.14.0",
"eslint": "^6.0.0",
"eslint-config-airbnb": "^17.1.0",
"eslint": "^6.0.1",
"eslint-config-airbnb": "^17.1.1",
"eslint-plugin-import": "^2.18.0",
"eslint-plugin-jest": "^22.7.1",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-jest": "^22.7.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.14.2",
"flow-bin": "^0.101.1",
"husky": "^2.5.0",
"flow-bin": "^0.102.0",
"husky": "^3.0.0",
"jest": "^24.8.0",

@@ -77,3 +77,3 @@ "jest-environment-enzyme": "^7.0.2",

"jest-junit": "^6.4.0",
"lint-staged": "^8.2.1",
"lint-staged": "^9.2.0",
"make-dir-cli": "^2.0.0",

@@ -85,4 +85,4 @@ "prop-types": "^15.7.2",

"react-test-renderer": "^16.8.6",
"typescript": "^3.5.2"
"typescript": "^3.5.3"
}
}

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