{"_id":"u3","_rev":"12-4c419ac6887a17b350bcf5023cd1db3d","name":"u3","time":{"modified":"2023-07-22T20:56:29.049Z","created":"2015-05-03T12:51:14.815Z","0.0.1":"2015-05-03T12:51:14.815Z","0.0.2":"2015-05-03T12:55:58.893Z","0.0.3":"2015-05-03T14:04:13.582Z","0.1.0":"2016-08-28T22:15:30.776Z","0.1.1":"2021-09-22T11:56:09.317Z"},"maintainers":[{"name":"inf3rno","email":"laszlo.janszky@gmail.com"}],"dist-tags":{"latest":"0.1.1"},"description":"u3 - Utility Functions","readme":"# u3 - Utility Functions\r\n\r\nThis lib contains utility functions for e3, dataflower and other projects.\r\n\r\n## Documentation\r\n\r\n### Installation\r\n\r\n```bash\r\nnpm install u3\r\n```\r\n\r\n```bash\r\nbower install u3\r\n```\r\n\r\n#### Usage\r\n\r\nIn this documentation I used the lib as follows:\r\n\r\n```js\r\nvar u3 = require(\"u3\"),\r\n    cache = u3.cache,\r\n    eachCombination = u3.eachCombination;\r\n```\r\n\r\n### Function wrappers\r\n\r\n#### cache\r\n\r\nThe `cache(fn)` function caches the fn results, so by the next calls it will return the result of the first call.\r\nYou can use different arguments, but they won't affect the return value.\r\n\r\n```js\r\nvar a = cache(function fn(x, y, z){\r\n    return x + y + z;\r\n});\r\nconsole.log(a(1, 2, 3)); // 6\r\nconsole.log(a()); // 6\r\nconsole.log(a()); // 6\r\n```\r\n\r\n\r\nIt is possible to cache a value too.\r\n\r\n```js\r\nvar a = cache(1 + 2 + 3);\r\nconsole.log(a()); // 6\r\nconsole.log(a()); // 6\r\nconsole.log(a()); // 6\r\n```\r\n\r\n### Math\r\n\r\n#### eachCombination\r\n\r\nThe `eachCombination(alternativesByDimension, callback)` calls the `callback(a,b,c,...)` on each combination of the `alternatives[a[],b[],c[],...]`.\r\n\r\n```js\r\neachCombination([\r\n      [1, 2, 3],\r\n      [\"a\", \"b\"]\r\n  ], console.log);\r\n  /*\r\n      1, \"a\"\r\n      1, \"b\"\r\n      \r\n      2, \"a\"\r\n      2, \"b\"\r\n      \r\n      3, \"a\"\r\n      3, \"b\"\r\n  */\r\n```\r\n\r\nYou can use any dimension and number of alternatives. In the current example we used 2 dimensions. By the first dimension we used 3 alternatives: `[1, 2, 3]` and by the second dimension we used 2 alternatives: `[\"a\", \"b\"]`.\r\n\r\n## License\r\n\r\nMIT - 2016 Jánszky László Lajos","versions":{"0.1.0":{"name":"u3","version":"0.1.0","description":"u3 - Utility Functions","keywords":["utility functions"],"license":"MIT","author":{"name":"László Lajos Jánszky"},"repository":{"type":"git","url":"git+https://github.com/inf3rno/u3.git"},"bugs":{"url":"https://github.com/inf3rno/u3/issues"},"main":"index.js","scripts":{},"dependencies":{},"devDependencies":{},"gitHead":"086044d9b1c3a72915631bc9cdc8ac0314160a53","homepage":"https://github.com/inf3rno/u3#readme","_id":"u3@0.1.0","_shasum":"0060927663b68353c539cda99e9511d6687edd9d","_from":".","_npmVersion":"2.11.1","_nodeVersion":"4.2.1","_npmUser":{"name":"inf3rno","email":"laszlo.janszky@gmail.com"},"maintainers":[{"name":"inf3rno","email":"laszlo.janszky@gmail.com"}],"dist":{"shasum":"0060927663b68353c539cda99e9511d6687edd9d","tarball":"https://registry.npmjs.org/u3/-/u3-0.1.0.tgz","integrity":"sha512-u500G09egSj7Gozm97u6+qAsbKOqGlRTCrd00D0yzEGTw03qQmqMdkbnlfqbQymjFl792/LXCK287NYIs/2X2g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDUwOGNeVWfoNLUXoHSBD8IyNw/mF/U2oA5KMPmW2wSvwIgNvAXCua5SOFwPUyN3sC7eUwSeJA6ELHB6oN1OtuskDU="}]},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/u3-0.1.0.tgz_1472422528968_0.9291732569690794"},"directories":{}},"0.1.1":{"name":"u3","version":"0.1.1","description":"u3 - Utility Functions","keywords":["utility functions"],"license":"MIT","author":{"name":"László Lajos Jánszky"},"repository":{"type":"git","url":"git+https://github.com/inf3rno/u3.git"},"bugs":{"url":"https://github.com/inf3rno/u3/issues"},"main":"index.js","scripts":{"test":"jest test/"},"dependencies":{},"devDependencies":{"jest":"^27.2.1"},"gitHead":"61af796b6a3d98bdb0f04461530b7f6338228095","homepage":"https://github.com/inf3rno/u3#readme","_id":"u3@0.1.1","_nodeVersion":"13.12.0","_npmVersion":"6.14.4","_npmUser":{"name":"inf3rno","email":"laszlo.janszky@gmail.com"},"dist":{"integrity":"sha512-+J5D5ir763y+Am/QY6hXNRlwljIeRMZMGs0cT6qqZVVzzT3X3nFPXVyPOFRMOR4kupB0T8JnCdpWdp6Q/iXn3w==","shasum":"5f52044f42ee76cd8de33148829e14528494b73b","tarball":"https://registry.npmjs.org/u3/-/u3-0.1.1.tgz","fileCount":7,"unpackedSize":4300,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2+toCRA9TVsSAnZWagAA6GIQAKUbUVVL4ynwdGsDT9sA\nfDa0aumStxyb0cLUt+7QMrxljMYwMU67sLoN+RfR+sbNtHZ3ArtHXIDhkhs0\nyBUWsuqo1NGl8MXINqRV1kU9YKYkDeXQqDNiM93iLRbzXjVQWZRU5mFFALRe\nTQo5LQDoK3e0tG6vB6iSOz5xAyDViX6yNOug12+W3aHbH73goXbwjHcu6hSL\nSAltL5GYr13xEzQ1w53OrjPqrh2+0WPImq8KLTD6JIJn9pHi4x29ThYwxkMJ\n+ZytoPnYC2kPINW2l0HHBGA4EaPeq3aq4dD0UjaQlM0Se5JVzedaCWH+XePp\nzE5IBoJLc37VjO6nRUxGKomtW44GST688NHT84Iwno/bohAbKi1/9YJkEDhb\nJ3q1H2HilwpFAkKbk0BvMm+hcV8htzg8TniPnBcafoXeAHWwTIcxKiunlgGI\nxubCVAXtfLkZvj0A81rTF/YoKONJZ/OH+SOC3Yfx/Jq+pLniANDSTyQAJef6\niT3QEPJngezEqAesLRd57Oa31iuRVjhzGu5eRVjOBOTG84DJRr1dJJREe98W\ntcGVrJ0PFG4rmQbvn0p4W3yxzODl8u6rRTnZ0zD0zCUt9m183ejJnZLSZrXx\n3J2IXjTswKzU7Zk9W6CDtfWrpBBjXM4dPpyFyLshp7YBZVliy8+881lilQX3\na6aP\r\n=NiBN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCmUKMy22IHpWNBtyLnijWcPUDYUH4vLYRE4fLYCTUEiAIgaJHYZt5C/BIP0ufz951Kx8QKKbtPE6zyZhTp63a5ZGQ="}]},"directories":{},"maintainers":[{"name":"inf3rno","email":"laszlo.janszky@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/u3_0.1.1_1632311769168_0.35345728824473865"},"_hasShrinkwrap":false}},"homepage":"https://github.com/inf3rno/u3#readme","keywords":["utility functions"],"repository":{"type":"git","url":"git+https://github.com/inf3rno/u3.git"},"author":{"name":"László Lajos Jánszky"},"bugs":{"url":"https://github.com/inf3rno/u3/issues"},"license":"MIT","readmeFilename":"README.md","users":{"flumpus-dev":true}}