{"_id":"@accuser/unist-util-flatmap","_rev":"2-42deae3829c36a40e59ca583e38ffb1b","name":"@accuser/unist-util-flatmap","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@accuser/unist-util-flatmap","version":"1.0.0","keywords":["unist","flatmap"],"author":{"url":"https://github.com/accuser","name":"Matthew Gibbons","email":"mhgibbons@me.com"},"license":"MIT","_id":"@accuser/unist-util-flatmap@1.0.0","maintainers":[{"name":"accuser","email":"mhgibbons@me.com"}],"homepage":"https://github.com/accuser/unist-util-flatmap#readme","bugs":{"url":"https://github.com/accuser/unist-util-flatmap/issues"},"dist":{"shasum":"a48095afcc1ed5549d934573578d70e0df2184ca","tarball":"https://registry.npmjs.org/@accuser/unist-util-flatmap/-/unist-util-flatmap-1.0.0.tgz","fileCount":7,"integrity":"sha512-AQQWGhXMM/Q+u+Bh+Dbr9umflywyb02I9MdG3KwsGL1LKF+4PJC94BxYzj83fjVqr9NRwCL77wbnTLn1nIQYIg==","signatures":[{"sig":"MEUCIQDN2UTe7Ah4ijD4odGoz5kWJfoXNy43KElRyfYIvd3fsgIgTYspeffTLNvUlOFVRkUlgAGPNJki7Zc+YCaMYX8oNSM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":6671},"main":"dist/index.js","type":"module","_from":"file:accuser-unist-util-flatmap-1.0.0.tgz","types":"./dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"default":"./dist/index.js","require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.js"}},"./package.json":"./package.json"},"scripts":{"lint":"eslint","test":"vitest","build":"duel","format":"prettier --write {src,test}/**/*.{js,ts}"},"_npmUser":{"name":"accuser","email":"mhgibbons@me.com"},"_resolved":"/tmp/cd3798d3825c416994b71b9020cb2731/accuser-unist-util-flatmap-1.0.0.tgz","_integrity":"sha512-AQQWGhXMM/Q+u+Bh+Dbr9umflywyb02I9MdG3KwsGL1LKF+4PJC94BxYzj83fjVqr9NRwCL77wbnTLn1nIQYIg==","repository":{"url":"git+https://github.com/accuser/unist-util-flatmap.git","type":"git"},"_npmVersion":"10.8.2","description":"Flatmap for unist nodes (useful for transforming trees) without mutating them.","directories":{},"_nodeVersion":"20.17.0","_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.9.1","vitest":"^2.0.5","prettier":"^3.3.3","typescript":"^5.5.4","@types/unist":"^3.0.3","@types/eslint":"^9.6.1","unist-builder":"^4.0.0","@knighted/duel":"^1.0.8","typescript-eslint":"^8.4.0","eslint-config-prettier":"^9.1.0","@types/eslint-config-prettier":"^6.11.3"},"_npmOperationalInternal":{"tmp":"tmp/unist-util-flatmap_1.0.0_1725520996295_0.4605726427909205","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@accuser/unist-util-flatmap","version":"1.0.1","keywords":["unist","flatmap"],"author":{"url":"https://github.com/accuser","name":"Matthew Gibbons","email":"mhgibbons@me.com"},"license":"MIT","_id":"@accuser/unist-util-flatmap@1.0.1","maintainers":[{"name":"accuser","email":"mhgibbons@me.com"}],"homepage":"https://github.com/accuser/unist-util-flatmap#readme","bugs":{"url":"https://github.com/accuser/unist-util-flatmap/issues"},"dist":{"shasum":"3a7e4c0c7681101567f76ef8c8c2db949a9b8abd","tarball":"https://registry.npmjs.org/@accuser/unist-util-flatmap/-/unist-util-flatmap-1.0.1.tgz","fileCount":7,"integrity":"sha512-A9sI5OpKnLF62Zhpv6sItzSdj4N+uxk+/luqeu5h3Zpd/IZiD7tI0BipR24bZYo/8KINtiaD6W+Abwng5H8C7g==","signatures":[{"sig":"MEUCIQDIpDv7/hAsdKdZ/LdKvbaNdEcEzwLU7aPGapfss1S0PQIgANYnYV5L4MFyGc7lsj0zmNYtyyXRBoC6mGKDzXJH6HU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":6667},"main":"dist/index.js","type":"module","_from":"file:accuser-unist-util-flatmap-1.0.1.tgz","types":"./dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"default":"./dist/index.js","require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.js"}},"./package.json":"./package.json"},"scripts":{"lint":"eslint","test":"vitest","build":"duel","format":"prettier --write {src,test}/**/*.{js,ts}"},"_npmUser":{"name":"accuser","email":"mhgibbons@me.com"},"_resolved":"/tmp/8e2733ea1eab3404bf9c9f0adc849f00/accuser-unist-util-flatmap-1.0.1.tgz","_integrity":"sha512-A9sI5OpKnLF62Zhpv6sItzSdj4N+uxk+/luqeu5h3Zpd/IZiD7tI0BipR24bZYo/8KINtiaD6W+Abwng5H8C7g==","repository":{"url":"git+https://github.com/accuser/unist-util-flatmap.git","type":"git"},"_npmVersion":"10.8.2","description":"Flatmap for unist nodes (useful for transforming trees) without mutating them.","directories":{},"_nodeVersion":"20.17.0","_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.9.1","vitest":"^2.0.5","prettier":"^3.3.3","typescript":"^5.5.4","@types/unist":"^3.0.3","@types/eslint":"^9.6.1","unist-builder":"^4.0.0","@knighted/duel":"^1.0.8","typescript-eslint":"^8.4.0","eslint-config-prettier":"^9.1.0","@types/eslint-config-prettier":"^6.11.3"},"_npmOperationalInternal":{"tmp":"tmp/unist-util-flatmap_1.0.1_1725521250370_0.02839156307600299","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"@accuser/unist-util-flatmap","version":"1.0.2","description":"Flatmap for unist nodes (useful for transforming trees) without mutating them.","type":"module","main":"dist/index.js","exports":{".":{"default":"./dist/index.js","import":{"default":"./dist/index.js","types":"./dist/index.d.ts"},"require":{"default":"./dist/cjs/index.js","types":"./dist/cjs/index.d.ts"}},"./package.json":"./package.json"},"keywords":["unist","flatmap"],"author":{"name":"Matthew Gibbons","email":"mhgibbons@me.com","url":"https://github.com/accuser"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/accuser/unist-util-flatmap.git"},"bugs":{"url":"https://github.com/accuser/unist-util-flatmap/issues"},"devDependencies":{"@knighted/duel":"^1.0.8","@types/eslint":"^9.6.1","@types/eslint-config-prettier":"^6.11.3","eslint":"^9.9.1","eslint-config-prettier":"^9.1.0","prettier":"^3.3.3","typescript":"^5.5.4","typescript-eslint":"^8.4.0","unist-builder":"^4.0.0","vitest":"^2.0.5"},"dependencies":{"@types/unist":"^3.0.3"},"scripts":{"build":"duel","format":"prettier --write {src,test}/**/*.{js,ts}","lint":"eslint","test":"vitest"},"_id":"@accuser/unist-util-flatmap@1.0.2","types":"./dist/index.d.ts","homepage":"https://github.com/accuser/unist-util-flatmap#readme","_integrity":"sha512-K4MGJOlg9qh6UjRDDB6B6qIV22y1J6gEZ2FdLdFYkXk9pXXC4SFoGeSCao4kpeespicXA/9JrXwMS/9mb6w1Rg==","_resolved":"/tmp/b78b706cce06d3562ac1ef211dad47f7/accuser-unist-util-flatmap-1.0.2.tgz","_from":"file:accuser-unist-util-flatmap-1.0.2.tgz","_nodeVersion":"20.17.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-K4MGJOlg9qh6UjRDDB6B6qIV22y1J6gEZ2FdLdFYkXk9pXXC4SFoGeSCao4kpeespicXA/9JrXwMS/9mb6w1Rg==","shasum":"b00896d84b01fdcc052724a63193854294ade1fb","tarball":"https://registry.npmjs.org/@accuser/unist-util-flatmap/-/unist-util-flatmap-1.0.2.tgz","fileCount":7,"unpackedSize":6815,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCMNO5P29hJAnFRWwHDFalod9j4IMS37vK/k9ze/jMnegIgYCT9fGA9Ml1ZzhMeOyFUPgWBo+khdHXPmkPLb2QwY/4="}]},"_npmUser":{"name":"accuser","email":"mhgibbons@me.com"},"directories":{},"maintainers":[{"name":"accuser","email":"mhgibbons@me.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/unist-util-flatmap_1.0.2_1725535078695_0.08571105854137473"},"_hasShrinkwrap":false}},"time":{"created":"2024-09-05T07:23:16.209Z","modified":"2024-09-05T11:17:59.089Z","1.0.0":"2024-09-05T07:23:16.493Z","1.0.1":"2024-09-05T07:27:30.555Z","1.0.2":"2024-09-05T11:17:58.895Z"},"bugs":{"url":"https://github.com/accuser/unist-util-flatmap/issues"},"author":{"name":"Matthew Gibbons","email":"mhgibbons@me.com","url":"https://github.com/accuser"},"license":"MIT","homepage":"https://github.com/accuser/unist-util-flatmap#readme","keywords":["unist","flatmap"],"repository":{"type":"git","url":"git+https://github.com/accuser/unist-util-flatmap.git"},"description":"Flatmap for unist nodes (useful for transforming trees) without mutating them.","maintainers":[{"name":"accuser","email":"mhgibbons@me.com"}],"readme":"# unist-util-flatmap\n\n[![npm version](https://badge.fury.io/js/@accuser%2Funist-util-flatmap.svg)](https://badge.fury.io/js/@accuser%2Funist-util-flatmap)\n\nCreate a new [unist](https://github.com/syntax-tree/unist) tree by mapping over all nodes and flattening the result *without* mutating the original tree.\n\n## Installation\n\n```bash\nnpm install @accuser/unist-util-flatmap\n```\n\n## Usage\n\n```javascript\nimport flatmap from '@accuser/unist-util-flatmap';\n\nconst tree = {\n  type: 'root',\n  children: [\n\t{\n\t  type: 'paragraph',\n\t  children: [\n\t\t{ type: 'text', value: 'Hello, World!' },\n\t  ]\n\t}\n  ]\n};\n\nconst result = flatmap(tree, (node) => {\n  if (node.type === 'text') {\n\treturn [\n\t  { type: 'text', value: node.value.toUpperCase() }\n\t];\n  }\n\n  return [node];\n});\n\nconsole.log(result);\n```\n\nOutput:\n\n```javascript\n{ type: 'root',\tchildren: [{ type: 'paragraph',\tchildren: [{ type: 'text', value: 'HELLO, WORLD!' }] }] }\n```\n\n## Tests\n\n```bash\nnpm test\n```\n\n## License\n\n[MIT](https://raw.githubusercontent.com/accuser/unist-util-flatmap/main/LICENSE)\n","readmeFilename":"README.md"}