{"_id":"flattie","_rev":"4-1158af8bcfbdbdf17633368582056d33","name":"flattie","dist-tags":{"latest":"1.1.1"},"versions":{"0.0.0":{"name":"flattie","version":"0.0.0","repository":{"type":"git","url":"git+https://github.com/lukeed/flattie.git"},"description":"A tiny (188B) utility to flatten an object with customizable glue","unpkg":"dist/index.min.js","module":"dist/index.mjs","main":"dist/index.js","types":"index.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.js"},"./package.json":"./package.json"},"engines":{"node":">= 4"},"scripts":{"build":"bundt","bench":"node bench","test":"uvu -r esm test"},"keywords":["flatten","object","nested","flat"],"devDependencies":{"bundt":"1.1.1","esm":"3.2.25","uvu":"0.3.3"},"gitHead":"be2cf643703f36cb2788f11d289345c04cbc22de","bugs":{"url":"https://github.com/lukeed/flattie/issues"},"homepage":"https://github.com/lukeed/flattie#readme","_id":"flattie@0.0.0","_nodeVersion":"12.18.3","_npmVersion":"6.14.6","dist":{"integrity":"sha512-D+RTDvO8ZRk1MCcUYPlj03knYg1Fik9M5h4wWYsH19MPLpBgoC3FiQvH1h5CMd8gke0ONOhewNGcNBGeVGw9/Q==","shasum":"972c05fbc6788cbb79bd6f185a270db169c8c701","tarball":"https://registry.npmjs.org/flattie/-/flattie-0.0.0.tgz","fileCount":7,"unpackedSize":6078,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfV55pCRA9TVsSAnZWagAA84wP/2dzg5dJR8oY5x1kjSrX\nuuCnaKUzC/1PtqIYlyJMGo1c4WyUN2OAw6bFusxQYNvAbleyGKiljSUPA4Xp\nohq2M6xGC+2n4TBrwSvBxo0Cr1bTNIoUgkiRktgmlKRLqt9nS+jBElZ7ma0v\n1uTyJsCEEHRe62YfuxnNW38YYKxx4+XuYQkR4x2zBjQh9iYQhtIFrzOIs1UI\nngKFl1lecmw6aSK01EY6q1P8ycyuQQnO2cwhh7j1kOVMBaj/m470MrQKqLx3\nA8pIzAWIjyKitQsa0+re0Ay4jogmT9nYljGSXuIDniUTF5gIKvr2N7cU1Wm+\nel4dOKcKUxnN/wA86SSi5taO8evJO77Pyi3T8HyJfaaVdZr5+9JBBtdVyAbu\nye0qOVXMea/uFEGViHvrSJC2O7qX7tqK6bwt5F+eJOZ9F8SHmU9F636mRbHS\n1IR045A7ytGn8q26ezZGK8So2Oj/4pV5y8mZDMRxijc9JnmzPZYNtLIAE+nx\nYab0/dsPqqQwG0LKsGgIq7o3qQcDbXGkX9MFW5ajVEw3xPumSlHxY2orw/tN\nqCG4AcgbtYeiGMCZqj2zlwA/rrAO+UQpcojG5SIJs3StQ2SerghKXzmJS6Ll\nU42x4NREZWeVSGmK92UvqTpldiH9frFq0QW+SVKNrgXCq+dzdk6qi6G81a8r\nfpMz\r\n=wewL\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCbvblt/Z8mR07JnMZ5E8nDZxpj0n72a2ATTOSy8LTKjQIgDbkkqCSyzim+Zo2zKjzyhcRkJlszxzcSMc8jtHms96Y="}]},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/flattie_0.0.0_1599577705320_0.4299519430475929"},"_hasShrinkwrap":false},"1.0.0":{"name":"flattie","version":"1.0.0","repository":{"type":"git","url":"git+https://github.com/lukeed/flattie.git"},"description":"A tiny (187B) and fast utility to flatten an object with customizable glue","unpkg":"dist/index.min.js","module":"dist/index.mjs","main":"dist/index.js","types":"index.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.js"},"./package.json":"./package.json"},"engines":{"node":">=8"},"scripts":{"build":"bundt","bench":"node bench","test":"uvu -r esm test"},"keywords":["keys","flatten","object","nested","flat"],"devDependencies":{"bundt":"1.1.1","esm":"3.2.25","uvu":"0.3.3"},"gitHead":"833b3aa8431dce804f0f7ad61ae44a1a6cbf34a0","bugs":{"url":"https://github.com/lukeed/flattie/issues"},"homepage":"https://github.com/lukeed/flattie#readme","_id":"flattie@1.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"integrity":"sha512-74Kv8cuMPu5e3pz2tzom3VDxi7iVsWPHstSOzOO7nfP9fXnlCTzqhuQrvKjJG/LPWrvcEQGvG0ZeDgG+IEsmlg==","shasum":"7adf9ef5a67641c85f6587174c69588f3659936c","tarball":"https://registry.npmjs.org/flattie/-/flattie-1.0.0.tgz","fileCount":7,"unpackedSize":5978,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfV8RpCRA9TVsSAnZWagAAxfgQAJTpDkhcC8o6+3hjZWhX\nEJGbZklUlsntPcNbbBFdk4d4P/xnGVi/AY58ZdU+w7FWx5cM8yY7FcGjL+Vr\nu3iCxp2XPuqlc4Ar7cUL3vloOytE7AqjWHsi30tpmGE7rCaWmr8ipmxPVOtf\nmNB/TqQBYDilGcskOFcLkiDBiOPFBl1CU6H+899b4deB+5MT8OdrE0rLC92y\n55Gk+D9vUUZl4MY2h6C4KC7yF2mG8+2ngdxk5cM/tg16EwSpqRQZd8zUkSu+\nHp1OkNThOrTDerdgIkoK1N6u6Pm+l1+jKwALmYltwNCKTE0A6OinWjS4/ZuH\ncWs++KIDX8ee5P4SzhE/DwzeUIK7YkfNEtr0sD6NQnBKOJHqnK8MXacr9VH2\nS1BAE9OtKznriWg0ReGOIoju4Gn24xGC24K28BVcceAvbHz0+wmoYUB7wlWm\nbAvACP4PEQda9kVFF7m9J8oWvzURvls5DCJ8PiBH/4cwyD65XLCykahd/JN3\n5o9+UUkG5ZN9h1utak3XVoIlfRODxam9OyX4ZRMvkXORkf8jzr4CtduqIqZR\n9TKCMAfwNgoKf4RW5JCNCYKs+tdCA5JXvHXO+9BJRwvtI70YiomXWRJ1cL9v\n6g5rncEUFRydIvQNr5fJKT1kdRtZ0tzFz3iEqoUmX+yxHnYcvj8fsdMCPkBn\nl0Si\r\n=AwTl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCSog7XXyktKyjcEp95wN461GmdtvCXo3w6JpZyBnL0LgIhAK++LyJwkY9pJBAnKELHzXHEGmNRwM8+wpqA3kX0JRci"}]},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/flattie_1.0.0_1599587433036_0.31852142430752606"},"_hasShrinkwrap":false},"1.1.0":{"name":"flattie","version":"1.1.0","repository":{"type":"git","url":"git+https://github.com/lukeed/flattie.git"},"description":"A tiny (203B) and fast utility to flatten an object with customizable glue","unpkg":"dist/index.min.js","module":"dist/index.mjs","main":"dist/index.js","types":"index.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.js"},"./package.json":"./package.json"},"engines":{"node":">=8"},"scripts":{"build":"bundt","bench":"node bench","test":"uvu -r esm test"},"keywords":["keys","flatten","object","nested","flat"],"devDependencies":{"bundt":"1.1.1","esm":"3.2.25","uvu":"0.3.3"},"gitHead":"bc2182d9e43a305b82783e4d78485ca6cd246edf","bugs":{"url":"https://github.com/lukeed/flattie/issues"},"homepage":"https://github.com/lukeed/flattie#readme","_id":"flattie@1.1.0","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"integrity":"sha512-xU99gDEnciIwJdGcBmNHnzTJ/w5AT+VFJOu6sTB6WM8diOYNA3Sa+K1DiEBQ7XH4QikQq3iFW1U+jRVcotQnBw==","shasum":"1459504209f2001c478751b4e2fb69d6b1ee3241","tarball":"https://registry.npmjs.org/flattie/-/flattie-1.1.0.tgz","fileCount":7,"unpackedSize":6753,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfWR40CRA9TVsSAnZWagAAyxAP/3zz4QMeX4ps7vhq1KMF\n2BVIMRkkI14sF4sYFcD0k4UOuUoEQ/G0fu6jYZOje0Q/thMW2y1yKnkxWekp\nnDdO/dEQdZmZCinA9HEBMDJ4WcxjZKt59PAluBvpgRuJk26X9Y10fmjbaL5N\nENWdYIQzCfDh3bq8GIXnmXrn/9uJq41Ra9260a4z/9u3rmwPKbW1xb83aiuM\nBc4GJHVrLCLCpbS5hUTE2ukB3ruyEuD1cAOlMulrfC2od/p0QcBOiTbZZ5yR\ngX9lDS6ICMgSM3YjVevEG/8X7gka6j7wxyJJ8yxR3Q9mZrSdorzUiIdxN0Y0\ncUMZTo79rAZmv8UNq2x8qFZyMZwJskt5TfEEvP3uGBzND7Ce05ko+DXUc+n5\nCU92ENPCoFlQmWK4mNvloskHMy8yBPWCeZfrjD5r4t0RvxrG6GMncwQ+4EKR\nLKf8pdkNmTIic8RVOkes/N0os58HEBLENr3cGpo4sbyP6cnC/RNKFt4a2LaK\ntrFwl1OTgUVhamjogh2460+JJZtfqgrTir6cfv9gXwCCDxDYr/qUU4SoWQzQ\n9eFQNlbXJv0mzCFhAbl+Xj855zoVNri3uxyqBSchtx3HIklxDspTyqJ9zj9I\n70Lj22Ps+JSYwIY5VsHsaipenTRbYTDI/Sgcvp99FoLdtuwHVu9Dso2ajdaA\nzfzg\r\n=dnym\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAjo68mZPIM3M+Y79NEaHJ8LTdc5T9ytQOGSDjaz52OnAiA3KL9N1ju9I1zwIur1ojEN7JFr5z1gNJeCFx716/Vidw=="}]},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/flattie_1.1.0_1599675956250_0.8860156111403861"},"_hasShrinkwrap":false},"1.1.1":{"name":"flattie","version":"1.1.1","repository":{"type":"git","url":"git+https://github.com/lukeed/flattie.git"},"description":"A tiny (203B) and fast utility to flatten an object with customizable glue","unpkg":"dist/index.min.js","module":"dist/index.mjs","main":"dist/index.js","types":"index.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"exports":{".":{"types":"./index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./package.json":"./package.json"},"engines":{"node":">=8"},"scripts":{"build":"bundt","bench":"node bench","test":"uvu -r esm test"},"keywords":["keys","flatten","object","nested","flat"],"devDependencies":{"bundt":"1.1.1","esm":"3.2.25","uvu":"0.3.3"},"_id":"flattie@1.1.1","gitHead":"6bc22feb9674d8b39d7d3e01d5d711f4c5342ed5","bugs":{"url":"https://github.com/lukeed/flattie/issues"},"homepage":"https://github.com/lukeed/flattie#readme","_nodeVersion":"20.11.0","_npmVersion":"10.2.4","dist":{"integrity":"sha512-9UbaD6XdAL97+k/n+N7JwX46K/M6Zc6KcFYskrYL8wbBV/Uyk0CTAMY0VT+qiK5PM7AIc9aTWYtq65U7T+aCNQ==","shasum":"88182235723113667d36217fec55359275d6fe3d","tarball":"https://registry.npmjs.org/flattie/-/flattie-1.1.1.tgz","fileCount":7,"unpackedSize":6956,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCg+l4lJZMH2KjM8eExAqu+fdpAWwlNIf363SDB0SsQkgIga6YLm8HLUT33q73w0yZ6GIgeLK8+FMjY5spm/FyoPNs="}]},"_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"directories":{},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/flattie_1.1.1_1709762118207_0.8563250523845107"},"_hasShrinkwrap":false}},"time":{"created":"2020-09-08T15:08:25.319Z","0.0.0":"2020-09-08T15:08:25.426Z","modified":"2024-03-06T21:55:18.773Z","1.0.0":"2020-09-08T17:50:33.160Z","1.1.0":"2020-09-09T18:25:56.532Z","1.1.1":"2024-03-06T21:55:18.360Z"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"description":"A tiny (203B) and fast utility to flatten an object with customizable glue","homepage":"https://github.com/lukeed/flattie#readme","keywords":["keys","flatten","object","nested","flat"],"repository":{"type":"git","url":"git+https://github.com/lukeed/flattie.git"},"author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"bugs":{"url":"https://github.com/lukeed/flattie/issues"},"license":"MIT","readme":"# flattie [![CI](https://github.com/lukeed/flattie/workflows/CI/badge.svg)](https://github.com/lukeed/flattie/actions) [![codecov](https://badgen.now.sh/codecov/c/github/lukeed/flattie)](https://codecov.io/gh/lukeed/flattie)\n\n> A tiny (203B) and [fast](#benchmarks) utility to flatten an object with customizable glue\n\nThis module recursively squashes an Object/Array. The output is a flat object – AKA, it has a single level of depth.\n\nBy default, the `.` character is used to glue/join layers' keys together. This is customizable.\n\nFinally, by default, any keys with nullish values (`null` and `undefined`) are **not** included in the return object.\n\n## Install\n\n```\n$ npm install --save flattie\n```\n\n\n## Usage\n\n```js\nimport { flattie } from 'flattie';\n\nflattie({\n  a: 'hi',\n  b: {\n    a: null,\n    b: ['foo', '', null, 'bar'],\n    d: 'hello',\n    e: {\n      a: 'yo',\n      b: undefined,\n      c: 'sup',\n      d: 0,\n      f: [\n        { foo: 123, bar: 123 },\n        { foo: 465, bar: 456 },\n      ]\n    }\n  },\n  c: 'world'\n});\n// {\n//   'a': 'hi',\n//   'b.b.0': 'foo',\n//   'b.b.1': '',\n//   'b.b.3': 'bar',\n//   'b.d': 'hello',\n//   'b.e.a': 'yo',\n//   'b.e.c': 'sup',\n//   'b.e.d': 0,\n//   'b.e.f.0.foo': 123,\n//   'b.e.f.0.bar': 123,\n//   'b.e.f.1.foo': 465,\n//   'b.e.f.1.bar': 456,\n//   'c': 'world'\n// }\n```\n\n> **Note:** `null` and `undefined` values are purged by default.\n\n## API\n\n### flattie(input, glue?, keepNullish?)\nReturns: `Object`\n\nReturns a new object with a single level of depth.\n\n> **Important:** An object is always returned despite `input` type.\n\n#### input\nType: `Object|Array`\n\nThe object to flatten.\n\n#### glue\nType: `String`<br>\nDefault: `.`\n\nA string used to join parent key names to nested child key names.\n\n```js\nconst foo = { bar: 123 };\n\nflattie({ foo }); //=> { 'foo.bar': 123 }\nflattie({ foo }, '???'); //=> { 'foo???bar': 123 }\n```\n\n#### keepNullish\nType: `Boolean`<br>\nDefault: `false`\n\nWhether or not `null` and `undefined` values should be kept.\n\n```js\n// Note: Applies to Objects too\nconst foo = ['hello', null, NaN, undefined, /*hole*/, 'world'];\n\nflattie({ foo });\n//=> {\n//=>   'foo.0': 'hello',\n//=>   'foo.2': NaN,\n//=>   'foo.5': 'world'\n//=> }\n\nflattie({ foo }, '.', true);\n//=> {\n//=>   'foo.0': 'hello',\n//=>   'foo.1': null,\n//=>   'foo.2': NaN,\n//=>   'foo.3': undefined,\n//=>   'foo.4': undefined,\n//=>   'foo.5': 'world'\n//=> }\n```\n\n## Benchmarks\n\n> Running on Node.js v10.13.0\n\n```\nLoad Time:\n  flat             1.047ms\n  flatten-object   1.239ms\n  flat-obj         0.997ms\n  flattie          0.258ms\n\nValidation:\n  ✔ flat\n  ✔ flatten-object\n  ✔ flat-obj\n  ✔ flattie\n\nBenchmark:\n  flat               x 186,487 ops/sec ±1.28% (86 runs sampled)\n  flatten-object     x 199,476 ops/sec ±1.01% (93 runs sampled)\n  flat-obj           x 393,574 ops/sec ±1.41% (95 runs sampled)\n  flattie            x 909,734 ops/sec ±0.82% (93 runs sampled)\n```\n\n\n## Related\n\n* [nestie](https://github.com/lukeed/nestie) – A tiny (242B) and fast utility to expand a flattened object <br>_This is `flattie`'s reverse / counterpart._\n\n\n## License\n\nMIT © [Luke Edwards](https://lukeed.com)\n","readmeFilename":"readme.md"}