{"_id":"map2tree@4.0.1","bugs":{"url":"https://github.com/reduxjs/redux-devtools/issues"},"dist":{"shasum":"26789cd569b0490b4b751ff7aa287621cfe1c096","tarball":"http://registry-npm.ywwl.com/map2tree/download/map2tree-4.0.1.tgz","fileCount":6,"integrity":"sha512-FyjjvfqVVXVhQoVWtjVyepc2LCeQbAGk4d3q6dQb5XiREjwenG4SqQCvVW/Z4Cm0JPZoz8NOvqWt5BkaRJU65Q==","signatures":[{"sig":"MEYCIQCsQ7XN8rYUT2b+jSA8sxXZRIa5rjdFHjKd0Xdh0XIcRwIhAIibE2/6A1vk/0XqoqsyYDrZ/iJ/COvntmDZaPOHTCuR","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBwJykPZ2bly3nm6gD+1/9/wO9bwdl7PjjqfvtNx8dkuAiEA1jxvFHAN1hlM/uWfSQUccOASITcsjqS/r5nZT0YCnUE="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/map2tree@4.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":8500,"size":3163,"noattachment":false,"key":"/map2tree/-/map2tree-4.0.1.tgz"},"name":"map2tree","type":"module","author":"romseguy","exports":"./lib/index.js","license":"MIT","scripts":{"test":"vitest --run --project map2tree","build":"tsc","clean":"rimraf lib","type-check":"tsc --noEmit && tsc -p tsconfig.test.json --noEmit"},"version":"4.0.1","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"4c51b62e-63b5-4fdc-90d1-8705fe346f62"}},"homepage":"https://github.com/reduxjs/redux-devtools/tree/master/packages/map2tree","keywords":["map2tree","map-to-tree","mapToTree","map","tree"],"repository":{"url":"https://github.com/reduxjs/redux-devtools.git","type":"git"},"description":"Utility for mapping maps to trees","directories":{},"maintainers":[{"name":"timdorr","email":"timdorr@timdorr.com"},{"name":"romseguy","email":"rom.seguy@gmail.com"},{"name":"zalmoxisus","email":"zalmoxisus@gmail.com"},{"name":"methuselah96","email":"nbierema@gmail.com"}],"sideEffects":false,"dependencies":{"lodash-es":"^4.18.1"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"^6.1.4","vitest":"^5.1.0","immutable":"^5.1.9","typescript":"^7.0.2","@types/lodash-es":"^4.17.12"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/map2tree_4.0.1_1794268852306_0.46953734334328967"},"readme":"A pure function to convert a map into a tree structure. Created by [@romseguy](https://github.com/romseguy) and merged from [`romseguy/map2tree`](https://github.com/romseguy/map2tree).\n\nThe following opinions must be taken into account since the primary use case of this library is [redux-devtools-chart-monitor](https://github.com/reduxjs/redux-devtools/tree/master/packages/redux-devtools-chart-monitor):\n\n- Objects and arrays deeply nested within collections are not converted into a tree structure. See `someNestedObject` and `someNestedArray` in the [output](https://github.com/romseguy/map2tree#output) below, or the [corresponding test](https://github.com/romseguy/map2tree/blob/master/test/map2tree.js#L140).\n- Provides support for [Immutable.js](https://github.com/facebook/immutable-js) data structures (only List and Map though).\n\n# Usage\n\n```javascript\nmap2tree(\n  someMap,\n  (options = {\n    key: 'state', // the name you want for as the root node of the output tree\n    pushMethod: 'push', // use 'unshift' to change the order children nodes are added\n  }),\n);\n```\n\n# Input\n\n```javascript\nconst someMap = {\n  someReducer: {\n    todos: [\n      { title: 'map', someNestedObject: { foo: 'bar' } },\n      { title: 'to', someNestedArray: ['foo', 'bar'] },\n      { title: 'tree' },\n      { title: 'map2tree' },\n    ],\n    completedCount: 1,\n  },\n  otherReducer: {\n    foo: 0,\n    bar: { key: 'value' },\n  },\n};\n```\n\n# Output\n\n```javascript\n{\n  name: `${options.key}`,\n  children: [\n    {\n      name: 'someReducer',\n      children: [\n        {\n          name: 'todos',\n          children: [\n            {\n              name: 'todo[0]',\n              object: {\n                title: 'map',\n                someNestedObject: {foo: 'bar'}\n              }\n            },\n            {\n              name: 'todo[1]',\n              object: {\n                title: 'to',\n                someNestedArray: ['foo', 'bar']\n              }\n            },\n            // ...\n          ]\n        },\n        // ...\n      ]\n    },\n    {\n      name: 'otherReducer',\n      children: [\n        {\n          name: 'foo',\n          value: 0\n        },\n        {\n          name: 'bar',\n          object: {\n            key: 'value'\n          }\n        }\n      ]\n    }\n  ]\n}\n```\n","publish_time":1794268852405,"_cnpm_publish_time":1794268852405,"dist-tags":{"latest":"4.0.1"}}