{"_id":"@ack_inc/utils","_rev":"5-4cbb890eaff3781311294b5af44599e8","name":"@ack_inc/utils","dist-tags":{"latest":"2.0.1"},"versions":{"1.0.0":{"name":"@ack_inc/utils","version":"1.0.0","description":"A collection of utility functions I find myself needing across multiple projects","license":"MIT","author":{"name":"Anirudh Nimmagadda","email":"anirudh.nimmagadda@gmail.com"},"engines":{"node":">=12"},"repository":{"type":"git","url":"git+https://github.com/ackinc/node-utils.git"},"bugs":{"url":"https://github.com/ackinc/node-utils/issues"},"main":"index.js","scripts":{"test":"jest"},"devDependencies":{"eslint":"^7.25.0","eslint-plugin-jest":"^24.3.6","jest":"^26.6.3","jest-extended":"^0.11.5","prettier":"^2.2.1"},"keywords":["random string","generate random string","random string generator","group-by","group by","group by multiple keys","group-by multiple keys","mobile number formatter","format mobile number"],"gitHead":"3059a69175a96051f5f677b73e4e948a0cdc5dbb","homepage":"https://github.com/ackinc/node-utils#readme","_id":"@ack_inc/utils@1.0.0","_nodeVersion":"14.15.5","_npmVersion":"6.14.11","dist":{"integrity":"sha512-ez4G7LYtpjcHRIDD2Vi9Po6Kvn7AQqt/rF60tf6oFa3mcO1QvcQa22wYkkStd28bEPXHk5ojs74URl0oxSPskA==","shasum":"25d61e407f40e3053ca59445f1f15548dc3dd098","tarball":"https://registry.npmjs.org/@ack_inc/utils/-/utils-1.0.0.tgz","fileCount":14,"unpackedSize":23253,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgl6/3CRA9TVsSAnZWagAAd3QP/RRYukjF2mF435WkD4pL\nNwV74AxyxOEOFt0tYa50/whs0wZ4Fyw36qycwyyFTCzm2lkC+qV+icpitd6c\neQgeLlHg9Io7FyQ7bTxpRxG3EuJEIEpwwQ5Wmzt9/F63SB4ItakHe+EZPTIV\nPla1WC4BCYBuTwgVg45W5bbujF1WqeymVb+SicbtVsmnlBDxwIxTUOCIsQAJ\nTfc5+dft5UT0bHBUIkqImB4sycf0c80ttqtguoeuqS2pRPD7XMZs7sCFelG8\n1IVRs9NihzP1g2OTBrBCu6ToDwgCjnuBNBfihzCxLZzIu75fsoCnbaxa9tjy\nDC6KzXUdq9DD9eDa4B5VAOHL1ZcSGUyqTU9IszWflcblmJ8NJXU5bBBWETjz\nr/hndAaZOyEMVWPchrtuCZX7rsz0UFt3fxqM6iRvkGBOhWB0tcTr3dExy3Oy\n+2VErFn9QWZmm49IPPt6Pn6lIfNjeDASGtkr9hl4Z4EvHtY3dlaUvFngp9RN\nEQGUvKPXQw7PqzR7Szq2xv9eIANFl0apmhUMA8GtmLTfajjDgNbhREg2EIEI\nvPFG8C9wnrhMbF2dSsX5Im1M75J5kQGZf9Wk4qJM4OB5/kyFYRgJiCj8xD4q\n6iv1UcTr+NxsLqiCjyVzawmrTxH8TkraJpDfDd2dH/busjszeU4H9VNEXne1\nMPSp\r\n=At1m\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEj2l9I54VreuCh1NPU+5dEZCLpw6T1P2xS0acb2WSSyAiEA0YwvCEkAVrvdA+UXoFnuQt5BfKZfJdPQtoRnU2DHnW0="}]},"_npmUser":{"name":"ack_inc","email":"anirudh.nimmagadda@gmail.com"},"directories":{},"maintainers":[{"name":"ack_inc","email":"anirudh.nimmagadda@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/utils_1.0.0_1620553719377_0.8482443754237965"},"_hasShrinkwrap":false},"1.0.1":{"name":"@ack_inc/utils","version":"1.0.1","description":"A collection of utility functions I find myself needing across multiple projects","license":"MIT","author":{"name":"Anirudh Nimmagadda","email":"anirudh.nimmagadda@gmail.com"},"engines":{"node":">=12"},"repository":{"type":"git","url":"git+https://github.com/ackinc/node-utils.git"},"bugs":{"url":"https://github.com/ackinc/node-utils/issues"},"main":"index.js","scripts":{"test":"jest"},"devDependencies":{"eslint":"^7.25.0","eslint-plugin-jest":"^24.3.6","jest":"^26.6.3","jest-extended":"^0.11.5","prettier":"^2.2.1"},"keywords":["random string","generate random string","random string generator","group-by","group by","group by multiple keys","group-by multiple keys","mobile number formatter","format mobile number"],"gitHead":"43e8734b2b57d9d24cbb3968dd8fcd58eb12e27f","homepage":"https://github.com/ackinc/node-utils#readme","_id":"@ack_inc/utils@1.0.1","_nodeVersion":"16.6.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-ek4RGvy4FMLojdGScZiRj6AYNcqK/ja5g0HvQVkLRSNs1HsAl3CdOlILbYShAiHxQeHCEhr9sojLnGZa4uM/Yg==","shasum":"8cc6c01074c463b8726ab32b472c6b9378b9c4f8","tarball":"https://registry.npmjs.org/@ack_inc/utils/-/utils-1.0.1.tgz","fileCount":15,"unpackedSize":24461,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiIfPqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoB9g/+PSY+Cdp4TGfuBiK2R9qp+V47nn0PpSdHHq0Eb4qO03UH3ou+\r\n7o2tF5aNwEiZ3mMNP8j78NZxBPkWsd1ThBu+7QW+hxLkPQVlM/GEj6n4sPvl\r\n9PbWKWxdrPZjtiiEOBbgdcrmeuJH+Nwq/8BOtWiqF6JBBPutFZtkj99csDcv\r\nejYjyG+yy70Qq3FOfdMGO52hw2A6iVQXaG2ArPM8Jjdl+44mTho9Q6hcnGok\r\ne4MXECmE8xMnLiZ1ekYF8OY7pkqWprJQ7j+LvTI6lsphaoWFHYnEkiqoTfsi\r\n7PeqQ5uW53zAHhTvp6mr0Fz3pyL5CE+aThFEVFPjCfLZhx7bztS+mbw2k32Y\r\necBzI8a+GrofKvSwb4+tgPvS1FU5iernz0yA0L/LgRwwbk3HrjT/UuhuLGp4\r\n9UmI8PQfY7TnylifDI1ERknrJUSsA5yDO6/l6REt4MtzW5m1LmmaeUSMCw/U\r\nH0ZclPMOrzhKyrCklp9FN27hLCKDyCBxz6aflZjzHFgrWqlZN/6JHznH9oD1\r\nkCzn42M0+EQmmF2XU6LZQrKzNvA/8hJPhDtxvDau83NCpxgfHJZVIJSlH/6c\r\n1d4VV/+xo1vIu/c0yHhIoSiJxSDd0QUxCug4zttL3uSvrPhkdeQGBrdtN/H/\r\nFHnnHucJQUi7Deur4YnmLmry0T9zlileZ24=\r\n=7Obu\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIExrrmK/oBBiPPmillKnvSEISBTqLYJ6W0YGkTHffOiaAiEA8h/vKp+Wu60MOC5vCPfFuk+5MhnEK0DoQhP9+rgNOnI="}]},"_npmUser":{"name":"ack_inc","email":"anirudh.nimmagadda@gmail.com"},"directories":{},"maintainers":[{"name":"ack_inc","email":"anirudh.nimmagadda@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/utils_1.0.1_1646392298340_0.915810966044452"},"_hasShrinkwrap":false},"1.1.0":{"name":"@ack_inc/utils","version":"1.1.0","description":"A collection of utility functions I find myself needing across multiple projects","license":"MIT","author":{"name":"Anirudh Nimmagadda","email":"anirudh.nimmagadda@gmail.com"},"engines":{"node":">=12"},"repository":{"type":"git","url":"git+https://github.com/ackinc/node-utils.git"},"bugs":{"url":"https://github.com/ackinc/node-utils/issues"},"main":"index.js","scripts":{"test":"jest"},"devDependencies":{"eslint":"^7.25.0","eslint-plugin-jest":"^24.3.6","jest":"^26.6.3","jest-extended":"^0.11.5","prettier":"^2.2.1"},"keywords":["random string","generate random string","random string generator","group-by","group by","group by multiple keys","group-by multiple keys","mobile number formatter","format mobile number"],"dependencies":{},"gitHead":"aa4559f3bf332bf0016ee8b26c66ae862ce24d1a","homepage":"https://github.com/ackinc/node-utils#readme","_id":"@ack_inc/utils@1.1.0","_nodeVersion":"16.16.0","_npmVersion":"8.11.0","dist":{"integrity":"sha512-2SPofU0z65zrNnOOyrf/Sb65h9LueppPRA3nRLwMrZeI718iBtWgitoGp97BF7LKn2mvQmpO16YR1VJC82u8og==","shasum":"a7fb9d36260ab8bfadd04fb8deda8753a016f4b4","tarball":"https://registry.npmjs.org/@ack_inc/utils/-/utils-1.1.0.tgz","fileCount":18,"unpackedSize":28002,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDsvLC7Vyj99gEf8o/Ef4MwpuCLw89oul6DWmqF3PfJEgIgGqRV1vW1dbksDNOZVYl3l3RX9hsz3lD34tNoaRIM6nc="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjZ8kzACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoosw//ccmKTjUzfgKZr8rh2njBdkWx9nzNDRJVb663g4mSYQYxNquO\r\nA2hoX/ezsNmCg3QLvV6rFln3ycDDsq2/zDdqt7aHf+B83j22q0zfSgV2yMPe\r\nr/IjzDyy7Or09Ypp2/ba5fTlQQozwpTTSuwhDYuM7uUwJnNP12+D4CtdSPaI\r\nP7+H4r+P3SG4zO2qoZ4BE0u3Y49gx5LIwozs7WbltnmtNnYzrCIJQsM8WaRZ\r\nH8G7ftQP2ZB6smVkmD964vBW3TevsHH19ymtn89ZzlpKBN5AQgP8CT9rVugJ\r\nOYxWuuVWQbfDtf7cb0EvCGo28TYLxxXI3/V+MZXqbBd0JaK2j7h4iSUnjXZR\r\nodOeBWSg9qWshes2VHjADA0nnl9oUMA8Mby8xk5qoJX/7dbF1e2eukvEyzd2\r\n//I/qd6LIbb9vUpU2Dl911s9Tj5TP3iZ831LNKCJ12zOikZZ2qT6Heme6AEX\r\nSrlP6iqfvipjWuSX7bP08Dk9hDnfcXO7SA+aXsVnjV3304GDWxgQDGZQeINi\r\nvk6qWwMhH/n1Gs9emw33s6vf9kMHlDPTLyp8aWfM0yolnPFjOzGArvrYTfki\r\nFxXKrIRFm9MhoToeKUrGDeU0N1AosTsyyCIQrCEB02QeNc+TAObg7Y83VgFW\r\nFZ7uvu8s0ao9+MzQUtsWJIP5IldOvyOFc4c=\r\n=A8SQ\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"ack_inc","email":"anirudh.nimmagadda@gmail.com"},"directories":{},"maintainers":[{"name":"ack_inc","email":"anirudh.nimmagadda@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/utils_1.1.0_1667746099615_0.8463225805751544"},"_hasShrinkwrap":false},"2.0.0":{"name":"@ack_inc/utils","version":"2.0.0","description":"A collection of utility functions I find myself needing across multiple projects","license":"MIT","author":{"name":"Anirudh Nimmagadda","email":"anirudh.nimmagadda@gmail.com"},"engines":{"node":">=16"},"repository":{"type":"git","url":"git+https://github.com/ackinc/node-utils.git"},"bugs":{"url":"https://github.com/ackinc/node-utils/issues"},"main":"index.js","scripts":{"test":"jest"},"devDependencies":{"eslint":"^7.25.0","eslint-plugin-jest":"^24.3.6","jest":"^26.6.3","jest-extended":"^0.11.5","prettier":"^2.2.1"},"keywords":["random string","generate random string","random string generator","group-by","group by","group by multiple keys","group-by multiple keys","mobile number formatter","format mobile number","interpolate string"],"dependencies":{},"gitHead":"1016b1a8c25fcdfe91c3ef5d4b9c4e23a9127e75","homepage":"https://github.com/ackinc/node-utils#readme","_id":"@ack_inc/utils@2.0.0","_nodeVersion":"16.20.2","_npmVersion":"8.19.4","dist":{"integrity":"sha512-zvngkc/Bou5ZtzKPqz0TcWUx1tncIQVAAV3Dbay4wrIXWsepI+N1KSa48WPFtShXQ+dVlfwa3+X/rrxfxPc98Q==","shasum":"0a5e6fd9e37d21beeabeed7213eb6be844571a42","tarball":"https://registry.npmjs.org/@ack_inc/utils/-/utils-2.0.0.tgz","fileCount":20,"unpackedSize":30184,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDUHIFAluJvfh36RInvRys+DGqMJyCh53qqDvZkP8eMqgIgB/ymnqLpICf5MIG7SWnvu0Eg/rwiS0vKGm02kJQJ6DE="}]},"_npmUser":{"name":"ack_inc","email":"anirudh.nimmagadda@gmail.com"},"directories":{},"maintainers":[{"name":"ack_inc","email":"anirudh.nimmagadda@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/utils_2.0.0_1692200631870_0.0826053730158065"},"_hasShrinkwrap":false},"2.0.1":{"name":"@ack_inc/utils","version":"2.0.1","description":"A collection of utility functions I find myself needing across multiple projects","license":"MIT","author":{"name":"Anirudh Nimmagadda","email":"anirudh.nimmagadda@gmail.com"},"engines":{"node":">=16"},"repository":{"type":"git","url":"git+https://github.com/ackinc/node-utils.git"},"bugs":{"url":"https://github.com/ackinc/node-utils/issues"},"main":"index.js","scripts":{"test":"jest"},"devDependencies":{"eslint":"^7.25.0","eslint-plugin-jest":"^24.3.6","jest":"^26.6.3","jest-extended":"^0.11.5","prettier":"^2.2.1"},"keywords":["random string","generate random string","random string generator","group-by","group by","group by multiple keys","group-by multiple keys","mobile number formatter","format mobile number","interpolate string"],"dependencies":{},"gitHead":"47e15b56536820eb069c53fb0993d7340ac1fd31","homepage":"https://github.com/ackinc/node-utils#readme","_id":"@ack_inc/utils@2.0.1","_nodeVersion":"16.20.2","_npmVersion":"8.19.4","dist":{"integrity":"sha512-g3n4CFajETIyT7yzwwTJOYnZ7a89Yr7lG/6L/DbBjDV/v5NaeBcvrbdz0a0T5bX0hKKmsOX5YN3e8u6XFUeC8Q==","shasum":"eb51e0f15ece0514bf8448aa0a401fe1c819fecf","tarball":"https://registry.npmjs.org/@ack_inc/utils/-/utils-2.0.1.tgz","fileCount":20,"unpackedSize":30268,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCBJD3so6Otb0nLjsd0MAU4xJxY/cj01LWOyZBUS93uDgIgEXNK8UJVPcPlFjwXvdPvi8yLkaNEbUfX8Q8rdJ6sISk="}]},"_npmUser":{"name":"ack_inc","email":"anirudh.nimmagadda@gmail.com"},"directories":{},"maintainers":[{"name":"ack_inc","email":"anirudh.nimmagadda@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/utils_2.0.1_1692201464663_0.9353698874440106"},"_hasShrinkwrap":false}},"time":{"created":"2021-05-09T09:48:39.331Z","1.0.0":"2021-05-09T09:48:39.532Z","modified":"2023-08-16T15:57:44.974Z","1.0.1":"2022-03-04T11:11:38.503Z","1.1.0":"2022-11-06T14:48:19.789Z","2.0.0":"2023-08-16T15:43:52.121Z","2.0.1":"2023-08-16T15:57:44.821Z"},"maintainers":[{"name":"ack_inc","email":"anirudh.nimmagadda@gmail.com"}],"description":"A collection of utility functions I find myself needing across multiple projects","homepage":"https://github.com/ackinc/node-utils#readme","keywords":["random string","generate random string","random string generator","group-by","group by","group by multiple keys","group-by multiple keys","mobile number formatter","format mobile number","interpolate string"],"repository":{"type":"git","url":"git+https://github.com/ackinc/node-utils.git"},"author":{"name":"Anirudh Nimmagadda","email":"anirudh.nimmagadda@gmail.com"},"bugs":{"url":"https://github.com/ackinc/node-utils/issues"},"license":"MIT","readme":"# node-utils\n\nA collection of utility functions I find myself needing across multiple projects\n\nFunctions can be `required` individually like so: `const fn = require('@ack_inc/utils/lib/<fn-name-in-kebab-case>')`\n\n## Docs\n\n### generateRandomString(nChars, constraints)\n\nGenerates a string of length `nChars` that satisfies `constraints`\n\nUse case: password or temporary token generation\n\n#### Parameters\n\n| Name        | Type   | Required? | Description                                                       | Default | Comments                |\n| ----------- | ------ | :-------: | ----------------------------------------------------------------- | ------- | ----------------------- |\n| nChars      | number |     Y     | The length of the string to generate                              |         | Must be a whole number. |\n| constraints | object |     N     | Object specifying what characters can be in the generated string. | {}      |                         |\n\n`constraints` may have the following keys:\n\n| Key       | Type    | Effect                                  |\n| --------- | ------- | --------------------------------------- |\n| lowercase | Boolean | If `true`, include lowercase characters |\n| uppercase | Boolean | If `true`, include uppercase chracters  |\n| digits    | Boolean | If `true`, include digits               |\n| symbols   | Boolean | If `true`, include symbols              |\n\nIf `constraints` has none of the above keys, it is assumed that all characters are allowed\n\nLook in `lib/generate-random-string.js` for the full list of symbols used\n\n#### Return value\n\n| Type   | Description       |\n| ------ | ----------------- |\n| string | The random string |\n\n#### Usage\n\n```node.js\nconst { generateRandomString: rsg } = require('@ack_inc/utils');\nconsole.log(rsg(<anything but a whole number>)); //=> throws TypeError\nconsole.log(rsg(0)); //=> \"\"\nconsole.log(rsg(5)); //=> \"3`8aE\"\nconsole.log(rsg(5, { lowercase: true })); //=> \"fewjk\"\nconsole.log(rsg(5, { lowercase: true, uppercase: true, digits: true, symbols: true })); //=> \"%q31G\"\n```\n\n---\n\n### groupByMultiKeys(records, getKeys)\n\nGroup an array of records into an array of sub-arrays of records. Records go into the same sub-array (\"group\") if any of the keys generated by getKeys are `===` equal\n\nUse case: you have an array of records (of people, say); the records are from multiple sources, and you want to merge records (for belonging to the same person) if any of several different \"identifiers\" (email, phone number, social media handle, etc.) match\n\n#### Parameters\n\n| Name    | Type           | Required? | Description                               | Default | Comments                                                                                                                           |\n| ------- | -------------- | :-------: | ----------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------- |\n| records | Array\\<object> |     Y     | Array of records to group                 |         | A TypeError is thrown if `records` is not an array with at least one element                                                       |\n| getKeys | Function       |     Y     | Function to generate keys for each record |         | Should take a record as the sole param, and return a single key or array of keys; signature is `getKeys(record: object): Array<T>` |\n\n#### Return value\n\n| Type                   | Description                                                                                 |\n| ---------------------- | ------------------------------------------------------------------------------------------- |\n| Array\\<Array\\<object>> | Each element of the returned array is a group of records for which at least one key matched |\n\nIt may not be the case that there is a common key for all the records in a group. Further, there may be two records in a group that have no keys in common. For example, the following three records will be in the same group, through `A` and `C` do not have a common key, because they each have a key in common with another record in the group:\n\n- Record `A` with keys ['a', 'b']\n- Record `B` with keys ['b', 'c']\n- Record `C` with keys ['c', 'd']\n\n#### Usage\n\nSee the tests in `lib/group-by-multi-keys.test.js` for usage examples\n\n---\n\n### formatMobileNumber(mobileNumber, formatString)\n\nFormat a mobile number (must include country code) in different ways\n\n#### Parameters\n\n| Name         | Type   | Required? | Description                                                          | Default | Comments                                                           |\n| ------------ | ------ | :-------: | -------------------------------------------------------------------- | ------- | ------------------------------------------------------------------ |\n| mobileNumber | string |     Y     | The mobile number to be formatted                                    |         | An error is thrown if `mobileNumber` does not contain country code |\n| formatString | string |     N     | String describing how the provided mobile number should be formatted | \"+CASR\" |                                                                    |\n\nIn `formatString`, only the following characters will be transformed:\n\n| Character | Transformed into                              |\n| --------- | --------------------------------------------- |\n| C         | country code                                  |\n| A         | area code (first 3 digits after country code) |\n| S         | subscriber number (next 3 digits)             |\n| R         | remaining digits                              |\n\nAny other characters will appear as-is in the returned string\n\n#### Return value\n\n| Type   | Description                 |\n| ------ | --------------------------- |\n| string | The formatted mobile number |\n\n#### Usage\n\n```nodejs\nconst { formatMobileNumber: format } = require('@ack_inc/utils');\nconsole.log(format(<anything but a mobile number with country code>)); //=> throws Error\n\nconst mobile = \"+1 123 456 7890\";\nexpect(format(mobile)).toEqual(\"+11234567890\");\nexpect(format(mobile, \"+CASR\")).toEqual(\"+11234567890\");\nexpect(format(mobile, \"+C A S R\")).toEqual(\"+1 123 456 7890\");\nexpect(format(mobile, \"+C (A) S-R\")).toEqual(\"+1 (123) 456-7890\");\n```\n\n---\n\n### buildArr(n, generatorFn)\n\nFormat a mobile number (must include country code) in different ways\n\n#### Parameters\n\n| Name        | Type     | Required? | Description                                                            | Default | Comments |\n| ----------- | -------- | :-------: | ---------------------------------------------------------------------- | ------- | -------- |\n| n           | number   |     Y     | The number of elements in the created array                            |         |          |\n| generatorFn | function |     N     | Function that controls the values of the elements in the created array | x => x  |          |\n\n#### Return value\n\n| Type  | Description     |\n| ----- | --------------- |\n| array | The built array |\n\n#### Usage\n\n```nodejs\nconst { buildArr } = require('@ack_inc/utils');\n\nexpect(buildArr(0)).toEqual([]);\nexpect(buildArr(2)).toEqual([0, 1]);\nexpect(buildArr(2, idx => idx + 1)).toEqual([1, 2]);\n```\n\n---\n\n### groupBy(records, groupFn)\n\nGroup records according to groupFn\n\n#### Parameters\n\n| Name    | Type            | Required? | Description                                                           | Default         | Comments |\n| ------- | --------------- | :-------: | --------------------------------------------------------------------- | --------------- | -------- |\n| records | Array\\<record\\> |     Y     | The records to be grouped                                             |                 |          |\n| groupFn | function        |     N     | Function that determines whether two records belong in the same group | (a, b) => false |          |\n\nA `record` is any object with an `id` key\n\n#### Return value\n\n| Type                     | Description                                       |\n| ------------------------ | ------------------------------------------------- |\n| Array\\<Array\\<record\\>\\> | Each sub-array in the returned array is one group |\n\n#### Usage\n\n- See group-by.test.js\n\n## To Do\n\n- Automated documentation generation\n\n- Improve `generateRandomString`\n\n  - Constraint: whitelisted chars\n  - Constraint: blacklisted chars\n  - Constraint: symbols that can be part of a url-component (See [SO answer](1))\n\n[1]: https://stackoverflow.com/questions/695438/what-are-the-safe-characters-for-making-urls\n","readmeFilename":"README.md"}