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 2.7.0 to 2.7.1

3

lib/deepFilter.d.ts
import type { ReactNode } from 'react';
import type { ReadonlyDeep } from 'type-fest';
declare const deepFilter: (children: ReadonlyDeep<ReactNode | ReactNode[]>, deepFilterFn: (child: ReadonlyDeep<ReactNode>, index?: number | undefined, children?: readonly (boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | null | undefined)[] | undefined) => boolean) => ReactNode[];
declare const deepFilter: (children: ReactNode | ReactNode[], deepFilterFn: (child: ReactNode, index?: number | undefined, children?: ReactNode[] | undefined) => boolean) => ReactNode[];
export default deepFilter;
//# sourceMappingURL=deepFilter.d.ts.map
import type { ReactNode } from 'react';
import type { ReadonlyDeep } from 'type-fest';
declare const deepFind: (children: ReadonlyDeep<ReactNode | ReactNode[]>, deepFindFn: (child: ReadonlyDeep<ReactNode>, index?: number | undefined, children?: readonly (boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | null | undefined)[] | undefined) => boolean) => ReactNode | undefined;
declare const deepFind: (children: ReactNode | ReactNode[], deepFindFn: (child: ReactNode, index?: number | undefined, children?: ReactNode[] | undefined) => boolean) => ReactNode | undefined;
export default deepFind;
//# sourceMappingURL=deepFind.d.ts.map
import type { ReactNode } from 'react';
import type { ReadonlyDeep } from 'type-fest';
declare const deepForEach: (children: ReadonlyDeep<ReactNode | ReactNode[]>, deepForEachFn: (child: ReadonlyDeep<ReactNode>, index?: number | undefined) => void) => void;
declare const deepForEach: (children: ReactNode | ReactNode[], deepForEachFn: (child: ReactNode, index?: number | undefined) => void) => void;
export default deepForEach;
//# sourceMappingURL=deepForEach.d.ts.map
import type { ReactNode } from 'react';
import type { ReadonlyDeep } from 'type-fest';
declare const deepMap: (children: ReadonlyDeep<ReactNode | ReactNode[]>, deepMapFn: (child: ReadonlyDeep<ReactNode>, index?: number | undefined, children?: readonly (boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | null | undefined)[] | undefined) => ReactNode) => ReactNode[];
declare const deepMap: (children: ReactNode | ReactNode[], deepMapFn: (child: ReactNode, index?: number | undefined, children?: ReactNode[] | undefined) => ReactNode) => ReactNode[];
export default deepMap;
//# sourceMappingURL=deepMap.d.ts.map
import type { ReactNode } from 'react';
import type { ReadonlyDeep } from 'type-fest';
declare const filter: (children: ReadonlyDeep<ReactNode | ReactNode[]>, filterFn: (child: ReadonlyDeep<ReactNode>, index?: number | undefined, children?: readonly (boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | null | undefined)[] | undefined) => boolean) => ReactNode[];
declare const filter: (children: ReactNode | ReactNode[], filterFn: (child: ReactNode, index?: number | undefined, children?: ReactNode[] | undefined) => boolean) => ReactNode[];
export default filter;
//# sourceMappingURL=filter.d.ts.map
import type { ReactNode } from 'react';
import type { ReadonlyDeep } from 'type-fest';
declare const getElementName: (element: ReadonlyDeep<ReactNode>) => string | null;
declare const getElementName: (element: ReactNode) => string | null;
export default getElementName;
//# sourceMappingURL=getElementName.d.ts.map
import type { ComponentClass, FunctionComponent, ReactNode } from 'react';
import type { ReadonlyDeep } from 'type-fest';
declare const groupByType: (children: ReadonlyDeep<ReactNode | ReactNode[]>, types?: readonly (ComponentClass<any> | FunctionComponent | string)[], rest?: string) => Record<string, ReactNode[]>;
declare const groupByType: (children: ReactNode | ReactNode[], types?: readonly (ComponentClass<any> | FunctionComponent | string)[], rest?: string) => Record<string, ReactNode[]>;
export default groupByType;
//# sourceMappingURL=groupByType.d.ts.map

@@ -7,7 +7,4 @@ import { Children } from 'react';

types = [], rest = 'rest') => {
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
const typeNames = types.map((type) => (typeof type === 'string' ? type : type.name));
return Children.toArray(children).reduce(
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
(acc, child) => {
return Children.toArray(children).reduce((acc, child) => {
const elementName = getElementName(child);

@@ -14,0 +11,0 @@ const key = elementName !== null && typeNames.includes(elementName) ? elementName : rest;

import type { ReactElement, ReactNode } from 'react';
import type { ReadonlyDeep } from 'type-fest';
declare const hasChildren: (element: ReadonlyDeep<ReactNode>) => element is ReactElement<{
children: ReadonlyDeep<ReactNode | ReactNode[]>;
declare const hasChildren: (element: ReactNode) => element is ReactElement<{
children: ReactNode | ReactNode[];
}, string | import("react").JSXElementConstructor<any>>;
export default hasChildren;
//# sourceMappingURL=hasChildren.d.ts.map
import { isValidElement } from 'react';
const hasChildren = (element) => isValidElement(element) &&
Boolean(element.props.children);
const hasChildren = (element) => isValidElement(element) && Boolean(element.props.children);
export default hasChildren;
//# sourceMappingURL=hasChildren.js.map
import type { ReactElement, ReactNode } from 'react';
import type { ReadonlyDeep } from 'type-fest';
declare const hasComplexChildren: (element: ReadonlyDeep<ReactNode>) => element is ReactElement<{
children: ReadonlyDeep<ReactNode | ReactNode[]>;
declare const hasComplexChildren: (element: ReactNode) => element is ReactElement<{
children: ReactNode | ReactNode[];
}, string | import("react").JSXElementConstructor<any>>;
export default hasComplexChildren;
//# sourceMappingURL=hasComplexChildren.d.ts.map
import type { ReactNode } from 'react';
import type { ReadonlyDeep } from 'type-fest';
export declare const childToString: (child?: ReadonlyDeep<ReactNode>) => string;
declare const onlyText: (children: ReadonlyDeep<ReactNode | ReactNode[]>) => string;
export declare const childToString: (child?: ReactNode) => string;
declare const onlyText: (children: ReactNode | ReactNode[]) => string;
export default onlyText;
//# sourceMappingURL=onlyText.d.ts.map
import type { ReactNode } from 'react';
import type { ReadonlyDeep } from 'type-fest';
declare const onlyValid: (children: ReadonlyDeep<ReactNode | ReactNode[]>) => ReactNode[];
declare const onlyValid: (children: ReactNode | ReactNode[]) => ReactNode[];
export default onlyValid;
//# sourceMappingURL=onlyValid.d.ts.map
{
"name": "react-children-utilities",
"version": "2.7.0",
"version": "2.7.1",
"type": "module",

@@ -36,3 +36,3 @@ "description": "Recursive and extended utils for React children opaque data structure",

"all-contributors": "all-contributors --config .all-contributorsrc.json",
"build": "tsc -p tsconfig.build.json && rollup -c && yarn flowgen",
"build": "tsc -p tsconfig.build.json && rollup -c && npm run flowgen",
"check-types": "tsc --noEmit && flow",

@@ -49,3 +49,3 @@ "clean": "del coverage lib react-children-utilities.*",

"prepublishOnly": "pinst --disable",
"preversion": "yarn verify",
"preversion": "npm run verify",
"size": "bundlewatch",

@@ -55,3 +55,3 @@ "test": "jest",

"update:normalize": "cp -rf node_modules/normalize.css/normalize.css docs/_sass/normalize.scss && prettier docs/_sass/normalize.scss --write",
"verify": "yarn format:check && yarn lint && yarn check-types && yarn test:coverage && yarn build && yarn size"
"verify": "npm run format:check && npm run lint && npm run check-types && npm run test:coverage && npm run build && npm run size"
},

@@ -62,34 +62,34 @@ "peerDependencies": {

"devDependencies": {
"@commitlint/cli": "^16.1.0",
"@commitlint/config-conventional": "^16.0.0",
"@types/jest": "^27.4.0",
"@types/react": "^17.0.38",
"@commitlint/cli": "^16.2.3",
"@commitlint/config-conventional": "^16.2.1",
"@types/jest": "^27.4.1",
"@types/react": "^17.0.39",
"@types/react-dom": "^17.0.11",
"@types/react-test-renderer": "^17.0.1",
"@typescript-eslint/eslint-plugin": "^5.10.1",
"@typescript-eslint/parser": "^5.10.1",
"@typescript-eslint/eslint-plugin": "^5.18.0",
"@typescript-eslint/parser": "^5.18.0",
"all-contributors-cli": "^6.20.0",
"bundlewatch": "^0.3.3",
"del-cli": "^4.0.1",
"eslint": "^8.7.0",
"eslint": "^8.13.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jest": "^26.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^26.1.4",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.3.0",
"flow-bin": "^0.170.0",
"flowgen": "^1.16.2",
"eslint-plugin-react": "^7.29.4",
"eslint-plugin-react-hooks": "^4.4.0",
"flow-bin": "^0.175.1",
"flowgen": "1.17.0",
"husky": "^7.0.4",
"jest": "^27.4.7",
"jest-junit": "^13.0.0",
"lint-staged": "^12.3.1",
"jest": "^27.5.1",
"jest-junit": "^13.1.0",
"lint-staged": "^12.3.7",
"normalize.css": "^8.0.1",
"pinst": "^2.1.6",
"prettier": "^2.5.1",
"pinst": "^3.0.0",
"prettier": "^2.6.2",
"prettier-plugin-organize-imports": "^2.3.4",
"prettier-plugin-pkg": "^0.11.1",
"prettier-plugin-sh": "^0.8.1",
"prettier-plugin-pkg": "^0.13.0",
"prettier-plugin-sh": "^0.10.1",
"raf": "^3.4.1",

@@ -99,11 +99,7 @@ "react": "^17.0.2",

"react-test-renderer": "^17.0.2",
"rollup": "^2.66.0",
"rollup": "^2.70.1",
"rollup-plugin-terser": "^7.0.2",
"ts-jest": "^27.1.3",
"type-fest": "^2.10.0",
"typescript": "^4.5.5"
"ts-jest": "^27.1.4",
"typescript": "^4.6.3"
},
"resolutions": {
"strip-ansi": "^6.0.1"
},
"sideEffects": false,

@@ -110,0 +106,0 @@ "bundlewatch": {

@@ -15,17 +15,17 @@ /// <reference types="react" />

declare const _default: {
deepFilter: (children: boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | readonly (boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | null | undefined)[] | null | undefined, deepFilterFn: (child: boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | null | undefined, index?: number | undefined, children?: readonly (boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | null | undefined)[] | undefined) => boolean) => import("react").ReactNode[];
deepFind: (children: boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | readonly (boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | null | undefined)[] | null | undefined, deepFindFn: (child: boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | null | undefined, index?: number | undefined, children?: readonly (boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | null | undefined)[] | undefined) => boolean) => import("react").ReactNode;
deepForEach: (children: boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | readonly (boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | null | undefined)[] | null | undefined, deepForEachFn: (child: boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | null | undefined, index?: number | undefined) => void) => void;
deepMap: (children: boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | readonly (boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | null | undefined)[] | null | undefined, deepMapFn: (child: boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | null | undefined, index?: number | undefined, children?: readonly (boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | null | undefined)[] | undefined) => import("react").ReactNode) => import("react").ReactNode[];
filter: (children: boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | readonly (boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | null | undefined)[] | null | undefined, filterFn: (child: boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | null | undefined, index?: number | undefined, children?: readonly (boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | null | undefined)[] | undefined) => boolean) => import("react").ReactNode[];
getElementName: (element: boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | null | undefined) => string | null;
groupByType: (children: boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | readonly (boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | null | undefined)[] | null | undefined, types?: readonly (string | import("react").ComponentClass<any, any> | import("react").FunctionComponent<{}>)[], rest?: string) => Record<string, import("react").ReactNode[]>;
hasChildren: (element: boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | null | undefined) => element is import("react").ReactElement<{
children: boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | readonly (boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | null | undefined)[] | null | undefined;
deepFilter: (children: import("react").ReactNode | import("react").ReactNode[], deepFilterFn: (child: import("react").ReactNode, index?: number | undefined, children?: import("react").ReactNode[] | undefined) => boolean) => import("react").ReactNode[];
deepFind: (children: import("react").ReactNode | import("react").ReactNode[], deepFindFn: (child: import("react").ReactNode, index?: number | undefined, children?: import("react").ReactNode[] | undefined) => boolean) => import("react").ReactNode;
deepForEach: (children: import("react").ReactNode | import("react").ReactNode[], deepForEachFn: (child: import("react").ReactNode, index?: number | undefined) => void) => void;
deepMap: (children: import("react").ReactNode | import("react").ReactNode[], deepMapFn: (child: import("react").ReactNode, index?: number | undefined, children?: import("react").ReactNode[] | undefined) => import("react").ReactNode) => import("react").ReactNode[];
filter: (children: import("react").ReactNode | import("react").ReactNode[], filterFn: (child: import("react").ReactNode, index?: number | undefined, children?: import("react").ReactNode[] | undefined) => boolean) => import("react").ReactNode[];
getElementName: (element: import("react").ReactNode) => string | null;
groupByType: (children: import("react").ReactNode | import("react").ReactNode[], types?: readonly (string | import("react").ComponentClass<any, any> | import("react").FunctionComponent<{}>)[], rest?: string) => Record<string, import("react").ReactNode[]>;
hasChildren: (element: import("react").ReactNode) => element is import("react").ReactElement<{
children: import("react").ReactNode | import("react").ReactNode[];
}, string | import("react").JSXElementConstructor<any>>;
hasComplexChildren: (element: boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | null | undefined) => element is import("react").ReactElement<{
children: boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | readonly (boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | null | undefined)[] | null | undefined;
hasComplexChildren: (element: import("react").ReactNode) => element is import("react").ReactElement<{
children: import("react").ReactNode | import("react").ReactNode[];
}, string | import("react").JSXElementConstructor<any>>;
onlyText: (children: boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | readonly (boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | null | undefined)[] | null | undefined) => string;
onlyValid: (children: boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | readonly (boolean | import("react").ReactText | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{}> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<Iterable<import("react").ReactNode>> | import("type-fest/source/readonly-deep").ReadonlyObjectDeep<import("react").ReactPortal> | null | undefined)[] | null | undefined) => import("react").ReactNode[];
onlyText: (children: import("react").ReactNode | import("react").ReactNode[]) => string;
onlyValid: (children: import("react").ReactNode | import("react").ReactNode[]) => import("react").ReactNode[];
map<T, C>(children: C | readonly C[], fn: (child: C, index: number) => T): C extends null | undefined ? C : Exclude<T, boolean | null | undefined>[];

@@ -32,0 +32,0 @@ forEach<C_1>(children: C_1 | readonly C_1[], fn: (child: C_1, index: number) => void): void;

@@ -20,9 +20,5 @@ # React Children Utilities

Available as a package and can be added to your application with npm or yarn after installing the peer dependency `react`
Can be added to your application after installing the peer dependency `react`
```sh
# with yarn
yarn add react-children-utilities react
# with npm
npm install --save react-children-utilities

@@ -29,0 +25,0 @@ ```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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