{"_id":"@akoskovacs/keyed-list","_rev":"5-4873c71a1fc2171daa436e30205709c8","name":"@akoskovacs/keyed-list","dist-tags":{"latest":"1.2.0"},"versions":{"1.0.0":{"name":"@akoskovacs/keyed-list","version":"1.0.0","description":"Immutable keyed list collection","homepage":"https://github.com/akoskovacs/keyed-list#readme","repository":{"type":"git","url":"git+https://github.com/akoskovacs/keyed-list.git"},"main":"index.js","scripts":{"format":"prettier --write \"src/**/*.ts\" \"src/**/*.js\"","lint":"eslint","test":"jest --config jestconfig.json","build":"tsc"},"keywords":["list","key","collection","id","guid","id-list","guid-list"],"author":{"name":"Ákos Kovács"},"license":"MIT","devDependencies":{"@types/jest":"^26.0.15","@typescript-eslint/eslint-plugin":"^4.9.0","@typescript-eslint/parser":"^4.9.0","eslint":"^7.14.0","eslint-config-prettier":"^6.15.0","jest":"^26.6.3","prettier":"^2.2.1","ts-jest":"^26.4.4","ts-node":"^9.0.0","typescript":"^4.1.2"},"gitHead":"ba14ef5f1739d385fdc3847ef094c7e8929c897c","bugs":{"url":"https://github.com/akoskovacs/keyed-list/issues"},"_id":"@akoskovacs/keyed-list@1.0.0","_nodeVersion":"12.19.0","_npmVersion":"6.14.9","dist":{"integrity":"sha512-cMXmOsAE6XUSBV8e6gY9BkXs8G0xrLEtMyiQUzfFGMUwBv6/YuszoY9fDgeDscm6owPCdOeAaa6p54dKgHZTag==","shasum":"9cc3fbd82f39bfbaf501972162adf50dce7ffe55","tarball":"https://registry.npmjs.org/@akoskovacs/keyed-list/-/keyed-list-1.0.0.tgz","fileCount":6,"unpackedSize":13896,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf1OkkCRA9TVsSAnZWagAA9LsP/j68OORYZorH16DSxmXI\nBxgLf9UIFct/pIJIMPFNMc+bR/AGIH6jI0gjy4fDD/q2f7O8AjQsd9cqZhGw\n/k85ttN83A/wlJGwl+oFEx52QDCv2TqHUXzwY3stLvu2NukH6JFIjqWdrBtd\nFMXymiFh2Ch4u7+E0Lrc+CyU4YUSLiEIYMw9ubqWBbm2UjTeBcA45rbg+dKD\nuIKqXwE6Jdfi4nMAJy0k0all2M796WTEXKbEOSun/YHlXnRkoXaRjT3Me/EZ\nC072vuQYkdGcmTdJByFII5+NS8fRR1jQ6CVMRJ7TT+30eAzSxYeGBRnmk8Tr\nyNRv87riDReaiusGD5ZriMzhCjRr9mzXA+H+GzLVDwFkS3bkOAmcpPJ/Rc9a\nlsnQUcjyOy34dJONZJlNHdwX2AKuVX4szVbPicP7fPOCnDVbmbLQYwbO2CQI\n2ViDKXtvbZR4nd0pNGo5coUgM10bkF6ppLgGMZUwHp1PJXZibX9ImEg6yw4I\naoQZNGqFXeSXuNe1PVWaqTTQrhRABxJUMd5YOApWys6sxQqLRjLg8pvHZEuy\nOIabZ5v5ItHRHQwxAF5qXtLDhYQk8b7CgQJnyhuYmOjtTESpGz2sRnmli91X\nymeUvJMqWBiE2Ow5B/wXUA7bJiv4qC76iwFi8AVpox42d3VBvlxO2dMNN4CC\nGEPp\r\n=VlSi\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCG6embOBnkHJwBXkrXpHZDe3d/qbf4C85zN48KVVvXtwIhAIXqdG/mVFyvNTIKMSM2s3Hu+QikmWjtoWvSjNz5fBA7"}]},"_npmUser":{"name":"akoskovacs","email":"akoskovacs0@gmail.com"},"directories":{},"maintainers":[{"name":"akoskovacs","email":"akoskovacs0@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/keyed-list_1.0.0_1607788835590_0.3505069270188399"},"_hasShrinkwrap":false},"1.0.1":{"name":"@akoskovacs/keyed-list","version":"1.0.1","description":"Immutable keyed list collection","homepage":"https://github.com/akoskovacs/keyed-list#readme","repository":{"type":"git","url":"git+https://github.com/akoskovacs/keyed-list.git"},"main":"lib/index.js","types":"lib/KeyedList.d.ts","prepublish":"tsc","scripts":{"format":"prettier --write \"src/**/*.ts\" \"src/**/*.js\"","lint":"eslint","test":"jest --config jestconfig.json","build":"tsc"},"keywords":["list","key","collection","id","guid","id-list","guid-list"],"author":{"name":"Ákos Kovács"},"license":"MIT","devDependencies":{"@types/jest":"^26.0.15","@typescript-eslint/eslint-plugin":"^4.9.0","@typescript-eslint/parser":"^4.9.0","eslint":"^7.14.0","eslint-config-prettier":"^6.15.0","jest":"^26.6.3","prettier":"^2.2.1","ts-jest":"^26.4.4","ts-node":"^9.0.0","typescript":"^4.1.2"},"gitHead":"911e4f8e27dcf4a997ffd278ee78312bbfee1abb","bugs":{"url":"https://github.com/akoskovacs/keyed-list/issues"},"_id":"@akoskovacs/keyed-list@1.0.1","_nodeVersion":"12.19.0","_npmVersion":"6.14.9","dist":{"integrity":"sha512-et3oGHDjlLg7gUkkZJPMdc39/SYAkt/miWnV3ittDscEwfOrTx/T5uujLqNFf+KnzRtkfIyM3K6tz6HYSAd5Kg==","shasum":"9db92098e17b70c486711a9d758cd79d8d563e32","tarball":"https://registry.npmjs.org/@akoskovacs/keyed-list/-/keyed-list-1.0.1.tgz","fileCount":6,"unpackedSize":28310,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf1OxxCRA9TVsSAnZWagAAZ/wQAINcz0JKoJZ8ZD0MsfdZ\nGbQNFPDpB0xr7BFcepDaQAmIW2KMCiXaD+zB6QD2M+bSKMMQFAtqYzHNJ6hv\nK7a3UpN8sTWCWyKtxsoawev5cpnHs7rvlUZ/cDM+TcZy0DEYJp71FKZcmK6E\nTBi+Inpzq0FE/A+VsZT75jje9Lba1l+1ZKNCv7bpV+OltXm9cCzmoUjBly4B\nUzLbYqiQwu2Mu+t6o62YeejNZyRJ0wI4I32jLvHbgp+c7iofX7Su54byvqJX\nuG7DtT5QI4FdzAzvRjBUft9+bcgfQAnr4Fl1cVCxZUO6fHeO0TT/cCxcb55t\ny2H5NNvYHIBOrmvXlkWoyrSN+5UOpC5d1+Z+xcc420AdvBE2/x0SiaW4EJKu\nHo8c5GFJ0nHcGO6GGxSvY2Kl+nCjdVPL+Q+c7KJzZoLFWl7T4DmUMYUsr65R\ngIicw8CR1NvpsaSryuz89PF9jPSaGJVSAnudgB76tvW1xE/8cZ5fc9wf57kA\no0h9dbPufEKOb9iOacD0cRcc7P2d7m8H5bxp2cGGiJqCZwKxYCFguXENcmTc\n0erAcxg3zk970I8o9aabnGIMIDwmBohyB/qgLtKjzFD+/7kfQMyeF0AoCF+z\nDMj22PkxlHG70l1MGmwM/itp5tbspg1QrNigxiJ0Xy9+pkfOzrFOS29r6db0\n8E+g\r\n=C+gc\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC4c8Bw+LiqwBT2ToxUEVV0Ibjk1EinOK+7YxA3Dz5LzQIgJmFIjXKTTbJ2eNNti0qjSwfm6RBnCcZbjGylwsICZlM="}]},"_npmUser":{"name":"akoskovacs","email":"akoskovacs0@gmail.com"},"directories":{},"maintainers":[{"name":"akoskovacs","email":"akoskovacs0@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/keyed-list_1.0.1_1607789681411_0.6652730276393721"},"_hasShrinkwrap":false},"1.0.2":{"name":"@akoskovacs/keyed-list","version":"1.0.2","description":"Immutable keyed list collection","homepage":"https://github.com/akoskovacs/keyed-list#readme","repository":{"type":"git","url":"git+https://github.com/akoskovacs/keyed-list.git"},"main":"lib/index.js","types":"lib/KeyedList.d.ts","prepublish":"tsc","scripts":{"format":"prettier --write \"src/**/*.ts\" \"src/**/*.js\"","lint":"eslint","test":"jest --config jestconfig.json","build":"tsc"},"keywords":["list","key","collection","id","guid","id-list","guid-list"],"author":{"name":"Ákos Kovács"},"license":"MIT","devDependencies":{"@types/jest":"^26.0.15","@typescript-eslint/eslint-plugin":"^4.9.0","@typescript-eslint/parser":"^4.9.0","eslint":"^7.14.0","eslint-config-prettier":"^6.15.0","jest":"^26.6.3","prettier":"^2.2.1","ts-jest":"^26.4.4","ts-node":"^9.0.0","typescript":"^4.1.2"},"gitHead":"5d37c44726a3645dbed508ab4b45df00c404808f","bugs":{"url":"https://github.com/akoskovacs/keyed-list/issues"},"_id":"@akoskovacs/keyed-list@1.0.2","_nodeVersion":"12.19.0","_npmVersion":"6.14.9","dist":{"integrity":"sha512-JmONtk7JQzAQdzdtcykotBouG9kFsxj6LEWxRwQo45KOn6HBatA3cUb/x5XA9cLj0AIsdM4e2uteb4tvUyoZoQ==","shasum":"bff237542c23be2a098ab9acd48abc43e2320b01","tarball":"https://registry.npmjs.org/@akoskovacs/keyed-list/-/keyed-list-1.0.2.tgz","fileCount":6,"unpackedSize":28328,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf1PDUCRA9TVsSAnZWagAAIJwP/0sMeQHMesrkQbIW6pAT\ngxIqLJ3uNXpb/zoC3m3uORlTtb3CilvDwVUazOu2IO+G5ElM31dmUlUuUj8Z\ntmwdeug7HjaOC55RjNoQHUxr2szMHXLqX6KYUIZIuK0Ovdoi3jcrc8RhUULv\n88S9HaxhEaLwvTh+grau93d2IfZuWmXtamckIBEQzhI43oNKgV6LK3q5aFsb\nnWwU3KpYB64B50fMTlCp1CFVMhf+xRedoTVCnDAjy2q4b72WZLPGC8ov0Zvh\n/B+feXFof5+gtGaibpJ5c+M4j+COt5k0DfERI+q2zO5+4Kqnx7+9iBX8vp02\nQlW6jF5j3ma9cU6FE3W7VSxIRdn+WERjnMFyTiWNuXHMgi/4taOU914Ur/Jx\nj4e33Y170oa+vwWgFqfvlK+/1XAEAcEcEwdKSL82vc80ayoMnRn1arajlH9J\n6ozQnY8Ih9AzS9EdSgGb23JJQmGhmvpg1VtSfKvdXEvWMVW7gH/jK33j3Ap8\nQ9EJ/CCG4nwvt3c7DVA4NBwsEbbGs2IEXlTcK1hgY8i4iNacErZpFkoyjZ2c\nkNCWFTOWP7mqFruW1SDWFaaKvgNzQCYqkv8m8oTW2TFCtGTmjtTxfE1eks6z\nQfgMOXMDK9lOf4Y+fODDbarJYFLOe1gY/NZiZ5vZ8Hfe9XyKpQcvaL14fqpX\n9Rtg\r\n=1uub\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGdO9DZCx7YUZdUoJLD+V9dShLrxYQl1L5JUg2rtIr2uAiAtO32pz0AHgFLtWUryRruVxxYqDti77wBePSlwtrKRcg=="}]},"_npmUser":{"name":"akoskovacs","email":"akoskovacs0@gmail.com"},"directories":{},"maintainers":[{"name":"akoskovacs","email":"akoskovacs0@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/keyed-list_1.0.2_1607790804034_0.24386406405595396"},"_hasShrinkwrap":false},"1.1.0":{"name":"@akoskovacs/keyed-list","version":"1.1.0","description":"Immutable keyed list collection","homepage":"https://github.com/akoskovacs/keyed-list#readme","repository":{"type":"git","url":"git+https://github.com/akoskovacs/keyed-list.git"},"main":"lib/index.js","types":"lib/KeyedList.d.ts","prepublish":"tsc","scripts":{"format":"prettier --write \"src/**/*.ts\" \"src/**/*.js\"","lint":"eslint","test":"jest --config jestconfig.json","build":"tsc"},"keywords":["list","key","collection","id","guid","id-list","guid-list"],"author":{"name":"Ákos Kovács"},"license":"MIT","devDependencies":{"@types/jest":"^26.0.15","@typescript-eslint/eslint-plugin":"^4.9.0","@typescript-eslint/parser":"^4.9.0","eslint":"^7.14.0","eslint-config-prettier":"^6.15.0","jest":"^26.6.3","prettier":"^2.2.1","ts-jest":"^26.4.4","ts-node":"^9.0.0","typescript":"^4.1.2"},"gitHead":"e5352af91ee9aea414de9aaedf0c21fb7c13a3f0","bugs":{"url":"https://github.com/akoskovacs/keyed-list/issues"},"_id":"@akoskovacs/keyed-list@1.1.0","_nodeVersion":"12.19.0","_npmVersion":"6.14.9","dist":{"integrity":"sha512-haCkviXidmVLUVyI8z89KQZ8qD1yk5gOb0ev+G2MX0UB2X/jS0hqPQnEKkk8n2ByXH9kHsv7HmfE+Lst2NLEEA==","shasum":"6bd4e192d108bf4b0bc0937b6777c6938d467a58","tarball":"https://registry.npmjs.org/@akoskovacs/keyed-list/-/keyed-list-1.1.0.tgz","fileCount":6,"unpackedSize":29740,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf1Pg9CRA9TVsSAnZWagAAXZQQAIOLnFmjs2tpHtB0J6CQ\nUcP488hXKe+j4rd+k9e7HbE36u6FqVWoMgDqTv6HOWfTP817JGIGgFN6Lvzh\nvmCYFe/pqbPehQbxhBjCq53ojsW74jc8L8fmxV+MnajwYg6FtZXzJ0jjRY6U\n4ti8vP4P1ExLYEo7CxwFXOIac3r4gm94RJlQ9SQrGZdOyHosM2F4WS10WK6E\n+58ItC2sBRWfQj/b5WVXrv5WXNiTmPAfWOA+d2lEZrVLIGo3QqDvfXMOSBO4\njWLKjmYvJ2c/He9BTSmVDhgMDpiqbrRoN/NYcB1JonmNbm/8lalwxmvWDcsd\nVTSlILilmueuKhR5ZvhAqxSAycjICtUTMKggKHshRjxLx13g3q52U+8a6/TF\nNtzMTGmtpBQtAtYj+ELBjgLbvEzhmNvPkQGRIQz9hMmZ/a1MZKDKqbnVIySc\nJZZ9wSZYTNgbBv8LB7iQAxgf3ddkLejKAKG1ISTQnEXqawGK/di9D4NbyCI6\np/hApTq/IBjFs73ceP2AGrZqoOaHY8rgKnIKhKfUR3D2atzbxk921pvnRbdl\nhfPwCBr23DXNg5gbQ2JjY4uLJEf8oSKU+uEFrMfCto6B4PGGGEXoirw+9+5L\nq8U+RZEw0+RIFALC+oBrq66NVn7AF4zjiIq9xiJQCyiMCLT0oUgkzR646dKJ\nrmv7\r\n=Gg5v\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBfjpiPK0D8LyIWOZVFWBsPN6dmPDZWbEvdov2WZMZe4AiEA1kd0lguJDMoQYnHfEL3WYSmFAWNlduLbdzv2hlX1UJk="}]},"_npmUser":{"name":"akoskovacs","email":"akoskovacs0@gmail.com"},"directories":{},"maintainers":[{"name":"akoskovacs","email":"akoskovacs0@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/keyed-list_1.1.0_1607792700580_0.06873493819495335"},"_hasShrinkwrap":false},"1.2.0":{"name":"@akoskovacs/keyed-list","version":"1.2.0","description":"Immutable keyed list collection","homepage":"https://github.com/akoskovacs/keyed-list#readme","repository":{"type":"git","url":"git+https://github.com/akoskovacs/keyed-list.git"},"main":"lib/index.js","types":"lib/KeyedList.d.ts","prepublish":"tsc","scripts":{"format":"prettier --write \"src/**/*.ts\" \"src/**/*.js\"","lint":"npx eslint","test":"npx jest --config jestconfig.json","build":"npx tsc"},"keywords":["list","key","collection","id","guid","id-list","guid-list"],"author":{"name":"Ákos Kovács"},"license":"MIT","devDependencies":{"@types/jest":"^26.0.15","@typescript-eslint/eslint-plugin":"^4.9.0","@typescript-eslint/parser":"^4.9.0","eslint":"^7.14.0","eslint-config-prettier":"^6.15.0","jest":"^26.6.3","prettier":"^2.2.1","ts-jest":"^26.4.4","ts-node":"^9.0.0","typescript":"^4.1.2"},"gitHead":"d251646c2d8705ceefb3df48c923896b9160171f","bugs":{"url":"https://github.com/akoskovacs/keyed-list/issues"},"_id":"@akoskovacs/keyed-list@1.2.0","_nodeVersion":"12.19.0","_npmVersion":"6.14.9","dist":{"integrity":"sha512-/YtxBVWBI1U7imdXIlW0v72Y5tliMrxq4q5EckQHXUu8ZzyWMN6tG6zx/YjbSeGBXl7+JnPXDm10+Jgs2oQMYA==","shasum":"df13f954c4bb429909946465ae5beba1121da617","tarball":"https://registry.npmjs.org/@akoskovacs/keyed-list/-/keyed-list-1.2.0.tgz","fileCount":6,"unpackedSize":30310,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf4qxyCRA9TVsSAnZWagAALCYP/1d2L3aPQr1Czs3Do24o\nye8VMw1f183Kja3oLRFgjmJJD34WJNOf8flpxGLigRHLIzA2ay6haqDv56rm\n7QjjRIKqAwrV5dGQsQptOqyZosdoD5A9H7Z2H2P9a4bMbe+j8lHKZO6FwbLC\nm/whVKGqrE7Sc0Osrp56+q/mivnwRswBw2U5GwULlSY+ug8ndQMggjFutE+2\nm41Oy1RbknAUcMOQCZIhUtti/M9dPpLvlfQntRK2j9X3VWm31uEzaQnh5hwT\nGkC3uXeSOTRHsznKTFmjG1hdegWsM1Q4q8d6D8xuBu2PPewQ3Ukkj10AxNuT\nHow0lywIAihEP+rpZeUrLZLdIpD0ilFcAw9qS6dUKtB8ZU1A7wADRmlyJUeA\nxAGK10zhuafpLZIjGqmKZI1+/2y3ksqXK1O0Cd0hS0IaGknTnvH8ooIcJd54\nA5sKFl++cNFo4eUwEy/66rAv13HudmzP7iWtERkTPPvdLe8+weOFMwd+oMps\nDIPw5eojU3vNzmUudwd1PAtqW812IKjG5L19kjS6t7MvqJH7eaFxCtAK6Gxf\naSW8Zrkjy+E211RVsihjqdH2s2pik0pm/6kNNyTWusJxNv1EWkc6iGK9de4H\n7kLN9cWV61ptOlvov9ci9YTcRrWYjzy9L6azxF+SW/sKgzdoBwEA4pfn+KrU\nSpCK\r\n=ad+i\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCJXFkP6KP9Af8q9CMdQOVQs+BlvTFKS4UsJ/jqwhq43AIgGqlv/YGYKfCsE8X04LLIgHzs5Qw9phZ+G+hv+AYD+HE="}]},"_npmUser":{"name":"akoskovacs","email":"akoskovacs0@gmail.com"},"directories":{},"maintainers":[{"name":"akoskovacs","email":"akoskovacs0@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/keyed-list_1.2.0_1608690802398_0.8313737134190173"},"_hasShrinkwrap":false}},"time":{"created":"2020-12-12T16:00:35.543Z","1.0.0":"2020-12-12T16:00:35.835Z","modified":"2022-04-04T12:31:05.669Z","1.0.1":"2020-12-12T16:14:41.534Z","1.0.2":"2020-12-12T16:33:24.183Z","1.1.0":"2020-12-12T17:05:00.732Z","1.2.0":"2020-12-23T02:33:22.560Z"},"maintainers":[{"name":"akoskovacs","email":"akoskovacs0@gmail.com"}],"description":"Immutable keyed list collection","homepage":"https://github.com/akoskovacs/keyed-list#readme","keywords":["list","key","collection","id","guid","id-list","guid-list"],"repository":{"type":"git","url":"git+https://github.com/akoskovacs/keyed-list.git"},"author":{"name":"Ákos Kovács"},"bugs":{"url":"https://github.com/akoskovacs/keyed-list/issues"},"license":"MIT","readme":"# keyed-list.ts\n\nEfficiently store and retreive list elements based on their `id` key. This approach has the same benefits as having both an array and a hash for the same list.\n\nWith the array we can simply iterate through the elements or use them by their index. And with the hash, we can efficiently retrieve them, just by the `id`. Although, this implementation will only store the `id`s in the array to conserve space. But, this mechanism is completely transparent, the user don't have to think about it.\n\nThe immutability makes this library easy to use with React or other functional libraries and is also less error-prone. \n\n## Installation\n\nThe preferred way is to add it to the project locally as a dependency:\n```sh\nnpm install --save @akoskovacs/keyed-list\n```\nOr via `yarn`:\n```sh\nyarn add @akoskovacs/keyed-list\n```\n\n## Usage\n\nThe list element must include a unqiue `id` property. The `id` can be a GUID given by an API. It then can be used to efficiently address the elements. Take this example:\n\n```ts\nimport keyedList from '@akoskovacs/keyed-list';\n\ninterface PostItem {\n  id: string;\n  author: string;\n  content: string;\n  createdAt: Date;\n};\n\nconst posts: PostItem[] = [\n  {\n    id: '1234',\n    author: 'John',\n    votes: 4,\n    content: 'Hello, world!',\n    createdAt: new Date('2020-12-11 10:45:21')\n  },\n  {\n    id: '2222',\n    author: 'Steve',\n    votes: 0,\n    content: 'Second post',\n    createdAt: new Date('2020-12-11 14:12:55')\n  },\n  {\n    id: '4242',\n    author: 'Peter',\n    votes: 2,\n    content: 'This is not the end',\n    createdAt: new Date('2020-12-11 14:12:55')\n  }\n];\n```\n\nAfter the API gave back the elements the library can start manipulating the data, with the following functions:\n\n| Function name     | Description                                          | Example                                                                                  |\n|-------------------|------------------------------------------------------|------------------------------------------------------------------------------------------|\n| ```fromArray```   | Create a list from an array                          | ```const list = keyedList.fromArray(posts);```                                           |\n| ```toArray```     | Converts the list back into an array                 | ```const newPosts = keyedList.toArray(list);```                                          |\n| ```getIds```      | Retrieve multiple elements by their ids              | ```const ids = keyedList.getIds(list);```                                                |\n| ```getById```     | Retrieve the element by its id                       | ```const steve = keyedList.getById(list, '2222');```                                     |\n| ```getByIds```    | Converts the list back into an array                 | ```const sp = keyedList.getByIds(list, ['4242, '2222']);```                              |\n| ```getIdByIndex```| Retrieve the id by the element's numeric index       | ```const firstId = keyedList.getIdByIndex(list, 0);```                                   |\n| ```getFirst```    | Gets the first element in the list                   | ```const first = keyedList.getFirst(list);```                                            |\n| ```getLast```     | Gets the last elemenet in the list                   | ```const last = keyedList.getLast(list);```                                              |\n| ```getByIndex```  | Gets the element by its index                        | ```const second = keyedList.getByIndex(list, 1);```                                      |\n| ```getCount```    | Get the length of the list                           | ```const count = keyedList.getCount(list);```                                            |\n| ```update```      | Update properties of given list element              | ```const newList = keyedList.update(list, { id: '4242', votes: 1 });```                  |\n| ```append```      | Adds a new element to the end the list               | ```const newList = keyedList.append(list, { id: '5200', author: 'Riley' /* ... */});```  |\n| ```insert```      | Insert a new element to the beginning of the list    | ```const newList = keyedList.insert(list, { id: '5200', author: 'Riley' /* ... */});```  |\n| ```removeById```  | Removes an element by its id                         | ```const newList = keyedList.removeById(list, '2222');```                                |\n| ```map```         | Iterates through the list elements                   | ```const nameArray = keyedList.map(list, p => p.author);```                              |\n| ```mapIds```      | Iterates through the `id`s of the list               | ```const ids = keyedList.mapIds(list, id => id);```                                      |\n| ```filter```      | Filters out elements which stasify a given condition | ```const nonZeroVotes = keyedList.filter(list, p => p.votes > 0);```                     |\n| ```sort```        | Sorts the array, by a given comparison function      | ```const sortedList = keyedList.sort(list, (left, right) => left.votes - right.votes);```|\n\n## A more complete example with React\n\n`Posts.tsx`:\n```tsx\n/* ... API handlers ...*/\n\ntype PostItemList = keyedList.IdKeyedList<PostItem>;\n\nconst Posts = () => {\n  const [posts, setPosts] = React.useState<PostItemList>(keyedList.fromArray());\n  const [isInitialized, setIsInitialized] = React.useState<boolean>(false);\n\n  React.useEffect(() => {\n    if (!isInitialized) {\n      if (!initialPosts) {\n        fetchAllPosts();\n      }\n      setIsInitialized(true);\n    } else {\n      fetchAllPosts();\n    }\n  }, []);\n\n  const fetchAllPosts = () => {\n    // fetchPosts does a GET request to load all posts into an array, then those are converted into a list\n    fetchPosts(cs => setPosts(keyedList.fromArray(cs)));\n  };\n\n  const submitPost = () => {\n    // savePost does the POST request for creating a new post, the new item then can be inserted to the list\n    savePost(content, (c) => {\n      setPosts(keyedList.insert(posts, c));\n      setContent(\"\");\n    });\n    return true;\n  };\n\n  const setPostContent = (id: string, content: string) => {\n    // When the content is edited, the new content is updated through this call\n    setPosts(keyedList.update(posts, { id, content }));\n    return true;\n  };\n\n  const voteOnPost = (id: string) => {\n    // When the post is voted on, the request will give back the number of all votes, so we can show it to the users\n    votePost(id, (votes) => {\n      setPosts(keyedList.update(posts, { id, vote: votes }));\n    });\n  };\n\n  const doDelete = (id: string) => {\n    if (confirm('Are you sure to delete this post?')) {\n      setPosts(keyedList.removeById(posts, id));\n    }\n  };\n\n  return (\n    <>\n      {\n        keyedList.mapIds(id =>\n          <Post\n            id={ id }\n            key={ id }\n            editContent={ setPostContent }\n            getById={ id => keyedList.getById(posts, id) }\n            onVote={ id => voteOnPost }\n            onDelete={ doDelete } />\n        )\n      }\n    </>\n  );\n};\n\nexport default Posts;\n```\n\n`Post.tsx`:\n```tsx\ninterface PostProps {\n  id: Uuid;\n  onEditContent?: (id: string, content: string) => void;\n  onVote?: (id: string) => void;\n  onDelete?: (id: string) => void;\n  getById?: (id: string) => PostItem;\n}\n\n\nexport const Post = ({ id, getById, setContent, onDelete }: PostProps) => {\n  const post = (id && getById) ? getById(id) : undefined;\n\n  if (!post)\n    return undefined;\n\n  return (\n    <div className=\"post\">\n      <p><em>Posted by { post.author }</em></p>\n      {\n        onVote &&\n          <button className=\"vote\" onClick={ () => onVote(id) } />\n      }\n      <p className=\"post-content\">\n        { post.content }\n      </p>\n      {\n        onEditContent &&\n        /* create and editor for the content and call onEditContent when done */\n      }\n      {\n        onDelete &&\n          <button className=\"delete\" onClick={ () => onDelete(id) } />\n      }\n    </div>\n  );\n};\n\n```\n","readmeFilename":"README.md"}