{"_id":"@anys/is-empty-react-node","_rev":"3-fe998d70fe07c4911532b04d772b3811","name":"@anys/is-empty-react-node","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@anys/is-empty-react-node","version":"1.0.0","keywords":["react","node","empty","check","utility"],"author":"","license":"MIT","_id":"@anys/is-empty-react-node@1.0.0","maintainers":[{"name":"cixiangtao","email":"mrcxt@foxmail.com"}],"dist":{"shasum":"de067eeacfd832825d2420b62106fa4834164285","tarball":"https://registry.npmjs.org/@anys/is-empty-react-node/-/is-empty-react-node-1.0.0.tgz","fileCount":7,"integrity":"sha512-9Hi+7/3x0NFXy2/W7tGBrOgPf31CchEcqy5GslEO1qjr5TfBZevEN4zwA88TdoFVtPLg5hIaNzX6rTWSMZxUWQ==","signatures":[{"sig":"MEYCIQD+rjaueAQ4GldXgT5DtOF2Z1pdCA0nwlL4qAGcyJvp6gIhALS5AQzwdqKREzOl1WI4iZdtV0NwmqD++umGrocdW7IJ","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":6331},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"042bce4bb715e9bc004ff3eff5ece0744c9767ae","scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","release":"release-it","test:watch":"vitest"},"_npmUser":{"name":"cixiangtao","email":"mrcxt@foxmail.com"},"_npmVersion":"10.8.2","description":"A utility to check if a React node is empty","directories":{},"_nodeVersion":"20.18.3","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^7.2.0","jsdom":"^22.0.0","react":"^18.2.0","vitest":"^0.34.0","react-dom":"^18.2.0","release-it":"^16.1.0","typescript":"^5.0.0","@types/react":"^18.2.0","@types/react-dom":"^18.2.0","@vitejs/plugin-react":"^4.0.0"},"peerDependencies":{"react":">=16.8.0"},"_npmOperationalInternal":{"tmp":"tmp/is-empty-react-node_1.0.0_1753413114442_0.746357791732098","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@anys/is-empty-react-node","version":"1.0.1","keywords":["react","node","empty","check","utility"],"author":"","license":"MIT","_id":"@anys/is-empty-react-node@1.0.1","maintainers":[{"name":"cixiangtao","email":"mrcxt@foxmail.com"}],"dist":{"shasum":"5268cccd603d7e9ce36ec77f373fc12e20ad5004","tarball":"https://registry.npmjs.org/@anys/is-empty-react-node/-/is-empty-react-node-1.0.1.tgz","fileCount":7,"integrity":"sha512-lvYpGt8g0BE6076toHyfrX2AsdNTE8ycedbnVUlpp9qs1CLWwndJn2vaLWW7x9jEADc81ATh/41aoAA79AAQXw==","signatures":[{"sig":"MEUCIE3hzYeUaZH2xBLhE2xBSStMmqYf8xAlUIP/emikyDMVAiEAygWhN5sntva1UpK4mXoiujgcvpU1R4goqQ4xQyRx41g=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":5904},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"a983b1532f284c7715eb14a6a1e5ad98b665ab37","scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","release":"npm run test && release-it","test:watch":"vitest"},"_npmUser":{"name":"cixiangtao","email":"mrcxt@foxmail.com"},"_npmVersion":"10.8.2","description":"A utility to check if a React node is empty","directories":{},"_nodeVersion":"20.18.3","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^7.2.0","jsdom":"^22.0.0","react":"^18.2.0","vitest":"^0.34.0","react-dom":"^18.2.0","release-it":"^16.1.0","typescript":"^5.0.0","@types/react":"^18.2.0","@types/react-dom":"^18.2.0","@vitejs/plugin-react":"^4.0.0"},"peerDependencies":{"react":">=16.8.0"},"_npmOperationalInternal":{"tmp":"tmp/is-empty-react-node_1.0.1_1753434145490_0.5895009022755755","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@anys/is-empty-react-node","version":"1.0.2","description":"A utility to check if a React node is empty","publishConfig":{"access":"public"},"main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.js","types":"./dist/index.d.ts"}},"scripts":{"build":"tsup","dev":"tsup --watch","test":"vitest run","test:watch":"vitest","release":"npm run test && release-it"},"keywords":["react","node","empty","check","utility"],"author":"","license":"MIT","peerDependencies":{"react":">=16.8.0"},"devDependencies":{"@types/react":"^18.2.0","@vitejs/plugin-react":"^4.0.0","jsdom":"^22.0.0","react":"^18.2.0","react-dom":"^18.2.0","@types/react-dom":"^18.2.0","release-it":"^16.1.0","typescript":"^5.0.0","tsup":"^7.2.0","vitest":"^0.34.0"},"_id":"@anys/is-empty-react-node@1.0.2","gitHead":"80fd22ab4314365ee2ab1184d3c88a330f735f9d","_nodeVersion":"20.18.3","_npmVersion":"10.8.2","dist":{"integrity":"sha512-lan45e3N9seuVBfFA44feg+O6Fdp8ziiFQrkzA4EBFj/8KRJqb9Lc2rCfVc6MBBIE5Ulwwq905TnuQLfc3x/Dw==","shasum":"c2af3503bdb05d507d79abba250c5357e19076a7","tarball":"https://registry.npmjs.org/@anys/is-empty-react-node/-/is-empty-react-node-1.0.2.tgz","fileCount":7,"unpackedSize":6209,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFFMH6cakZ2IwPOiEq1Rjj/XGzYvE4UHpGIQhkalGo97AiB6vkM7D6g7ysTsVx7Y0QVFC47eZIThn8zBXeojj58ncA=="}]},"_npmUser":{"name":"cixiangtao","email":"mrcxt@foxmail.com"},"directories":{},"maintainers":[{"name":"cixiangtao","email":"mrcxt@foxmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/is-empty-react-node_1.0.2_1753436394748_0.9560976441781495"},"_hasShrinkwrap":false}},"time":{"created":"2025-07-25T03:11:54.329Z","modified":"2025-07-25T09:39:55.144Z","1.0.0":"2025-07-25T03:11:54.646Z","1.0.1":"2025-07-25T09:02:25.679Z","1.0.2":"2025-07-25T09:39:54.944Z"},"license":"MIT","keywords":["react","node","empty","check","utility"],"description":"A utility to check if a React node is empty","maintainers":[{"name":"cixiangtao","email":"mrcxt@foxmail.com"}],"readme":"# @anys/is-empty-react-node\n\nA utility function for checking if a React node is empty.\n\n## Installation\n\nRecommended installation with pnpm:\n\n```bash\npnpm add @anys/is-empty-react-node\n```\n\nYou can also use other package managers:\n\n```bash\nnpm install @anys/is-empty-react-node\n# or\nyarn add @anys/is-empty-react-node\n# or\nbun add @anys/is-empty-react-node\n```\n\n## Usage\n\n```tsx\nimport { isEmptyReactNode } from '@anys/is-empty-react-node';\nimport React from 'react';\n\nfunction Example() {\n  const emptyNode = null;\n  const textNode = 'Hello';\n  const emptyArray = [];\n  const emptyFragment = <></>;\n  const emptyDiv = <div />;\n  const divWithContent = <div>Content</div>;\n\n  console.log(isEmptyReactNode(emptyNode)); // true\n  console.log(isEmptyReactNode(textNode)); // false\n  console.log(isEmptyReactNode(emptyArray)); // true\n  console.log(isEmptyReactNode(emptyFragment)); // true\n  console.log(isEmptyReactNode(emptyDiv)); // false\n  console.log(isEmptyReactNode(divWithContent)); // false\n\n  return <div>Example</div>;\n}\n```\n\n## API\n\n### isEmptyReactNode(node: React.ReactNode): boolean\n\nChecks if a React node is empty.\n\n#### Parameters\n\n- `node`: React node, can be any valid React node type.\n\n#### Return Value\n\n- `boolean`: Returns `true` if the node is empty, otherwise returns `false`.\n\n#### Definition of Empty Node\n\nThe following cases are considered empty nodes:\n\n- `null`\n- `undefined`\n- `false`\n- Empty array `[]`\n- Array with all empty children\n- React Fragment with no children `<></>`\n\nThe following cases are considered non-empty nodes:\n\n- React element with no children `<div />`\n- React element with children `<div>Content</div>`\n- React Fragment with children `<><div>Content</div></>`\n- React array with children `[<div>Content</div>]`\n- Text node without tags `'Hello'`\n\n## License\n\nMIT\n","readmeFilename":"README.md"}