{"_id":"@aspiesoft/async-extra","_rev":"5-34613159e195cef087b98850202f5d40","name":"@aspiesoft/async-extra","dist-tags":{"latest":"0.2.7"},"versions":{"0.2.3":{"name":"@aspiesoft/async-extra","version":"0.2.3","description":"Some additional functions to advance the capabilities of asynchronous code in javascript.","license":"MIT","author":{"name":"AspieSoft"},"repository":{"type":"git","url":"git://github.com/aspiesoft/async-extra.git"},"main":"index.js","keywords":["async","sync","extra","asynchronous","await","wait for value","async loop","js","javascript","nodejs","synchronous-async"],"devDependencies":{"miniforge-js":"^0.2.4"},"gitHead":"9ccb3e43e336427e29c0c99629c7391fe2939899","bugs":{"url":"https://github.com/aspiesoft/async-extra/issues"},"homepage":"https://github.com/aspiesoft/async-extra#readme","_id":"@aspiesoft/async-extra@0.2.3","_nodeVersion":"12.16.3","_npmVersion":"6.14.4","dist":{"integrity":"sha512-BWY3gIHHCqannqCBvmSULGCHcGwOA9BuRrgSrv+2218Lk/MmsoplE9cqn/y4CeygeNmUKbp+HKPelZhaB/52Vg==","shasum":"d30ce89336d0265c72933d48a663ef630654bc55","tarball":"https://registry.npmjs.org/@aspiesoft/async-extra/-/async-extra-0.2.3.tgz","fileCount":5,"unpackedSize":9353,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeyI9oCRA9TVsSAnZWagAAricQAIL0b/EaW8Yn45hNELTq\n7CBGO8rUu5C3qklXK4cgZsoCRYaQ0ID03iEpP4UXDGEcShXvLVG38clak90b\nTZSAnbLIMr5T3m2Jz1M3jlD+ImLe4czSJjbzd/DC94z4PtQ50ytVOjMoGlbp\nugu1WdplQ9jAJR447qfesS+BhkOPlRsFp2oX3senYK6vvFoyI4SSIHDe87er\nu5IZ+OMcvTpedjplxHDhY+yGUUeJA5Z96SgGJpd86KG0M6T0PX80XdFvtUm0\nIkxWQUtkYXXvtaA3RvE5Rm2qZNVm+sSySWWMva8K1/Y8Cl8AQFlcZH8TicA6\nP12ptMWNDcBpm1YiWVjr84ViIwld1w7u6SGHILt3XBx8PTE+bKJB7jVvg+QB\nQ62/T8Qq8wATOcD/nLGXmvWMEOg4HzTeFIOqxz9IRN2hNyi5nHgIi6g48VXf\nxggkFOtT6HkfYmisyoyZsdzzQUP7kxcdliAv3hZzsTB/beCfDLjHAvqi0vHo\nd25hb7gyznfU0xjTDL+kX8LzkVXXTjU5ofYX7yGUipuzMxayCE+2kwYEgaH/\nF28XVxk9Jh52cDcNnnrMasP83irLjG3oRmz+FmmotE9PPEdzXwUcqwwScNsF\nTb0PdP+cBMTzrJ9OUT+ETs6KDUmNZTgyMailbZZCdEoS+YexWXuqOnW9IFxj\nKDdf\r\n=e/k/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHBtYH5lsA/y9hW0EmUCwaSvrk6EIMPsUbUYWASxs9o/AiEAwZLnX5x9O6D0mtsPOIkZAp6GCi3gbLTTEkmvUSNU7EA="}]},"maintainers":[{"name":"aspiesoft","email":"aspiesoftweb@gmail.com"}],"_npmUser":{"name":"aspiesoft","email":"aspiesoftweb@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/async-extra_0.2.3_1590202215543_0.04857234776713404"},"_hasShrinkwrap":false},"0.2.4":{"name":"@aspiesoft/async-extra","version":"0.2.4","description":"Some additional functions to advance the capabilities of asynchronous code in javascript.","license":"MIT","author":{"name":"AspieSoft"},"repository":{"type":"git","url":"git://github.com/aspiesoft/async-extra.git"},"main":"index.js","keywords":["async","sync","extra","asynchronous","await","wait for value","async loop","js","javascript","nodejs","synchronous-async"],"devDependencies":{"miniforge-js":"^0.2.4"},"gitHead":"71e525e33207d81f049dad7a54943cbcef8c9bcb","bugs":{"url":"https://github.com/aspiesoft/async-extra/issues"},"homepage":"https://github.com/aspiesoft/async-extra#readme","_id":"@aspiesoft/async-extra@0.2.4","_nodeVersion":"12.16.3","_npmVersion":"6.14.4","dist":{"integrity":"sha512-HslHCgt00lNk2vd4sb2kCPGlRzLhDJBF3hT5zZ+rCtOetI45liMQK59Ymx3qUm+e25X2zcfRjjRdFBONdJaLZA==","shasum":"2e7367a49962b0c728e11309b37532eece7fec56","tarball":"https://registry.npmjs.org/@aspiesoft/async-extra/-/async-extra-0.2.4.tgz","fileCount":5,"unpackedSize":9353,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeyI/nCRA9TVsSAnZWagAAPJ4QAIqih0SQbgb7+Yp+TC1d\nOUfNLGQLekZ1aix20HsEceRWTHpEnKYT0ld/XJn1YRgxJi9kuLd2DR2JDk06\nPjGn6OgHnuH1/1x+IngRh10g0OXCMeR5UV/M+iYpaQbdZ4TIkEn5tkrCJGy3\nXvrQ9tGY+diqxpQXVImSPsDyrR7zx2KaKVXU3UP8uogROPi7LXLjfyXuyGEs\nwwi36bNBQGJO2fj2I07108UOp5dvSI4urL7QGBxKVLZzpeUlRTGWQd24e7e2\n+KRslla1L4ukCRVYRsBWL5Z3VfklmRyhGMOYrAaGCCoiVOUlvkyTD6KpCMas\n0LEVVWWBlkGUBEvONv79hLLGBRdizZB6jQTobPQm0fez4maAnbbCrR2rx0DE\nCpR0lOhBtGgwDkQfD6yezza1kGLK294z+z60nCDZ0m2S8H5IpzQ+ENZFZUhd\nIiCi4Xy6AommumkgVWfDg1nJLoP8WUpzRaQGB53AQCoB9oAAXbxbq24agLCh\n1MGaW8Ij8iO5fH0cvopcYCtMaRwN7h6zySzOZOth4VS7CQHwxNgsvFDXHKFP\nYJLKLnKvJsKBFyjO+UewxR6Cw6/GEjOn11zujDTVrOyNG6X1AnsQg2RaPKDk\n2GH9Dz64DN1cz/HJK0RDFMPBUUqWHSdnh2JaVL9pxX6+mGqCW4DvY4/zKztp\ncuqe\r\n=eogq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGpQ+TYVPpOSbjNHX92G/gNU34hVivPlL06cv2C2V2zjAiBcFIXTB0kYswOimxlISZ1TkaXyZ8OGV5kn0UhrwFDCNw=="}]},"maintainers":[{"name":"aspiesoft","email":"aspiesoftweb@gmail.com"}],"_npmUser":{"name":"aspiesoft","email":"aspiesoftweb@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/async-extra_0.2.4_1590202342630_0.8523596435299576"},"_hasShrinkwrap":false},"0.2.5":{"name":"@aspiesoft/async-extra","version":"0.2.5","description":"Some additional functions to advance the capabilities of asynchronous code in javascript.","license":"MIT","author":{"name":"AspieSoft"},"repository":{"type":"git","url":"git://github.com/aspiesoft/async-extra.git"},"main":"index.js","keywords":["async","sync","extra","asynchronous","await","wait for value","async loop","js","javascript","nodejs","synchronous-async"],"devDependencies":{"miniforge-js":"^0.2.4"},"gitHead":"e5416c11b50f1988248c43a71e07c094ce6eedff","bugs":{"url":"https://github.com/aspiesoft/async-extra/issues"},"homepage":"https://github.com/aspiesoft/async-extra#readme","_id":"@aspiesoft/async-extra@0.2.5","_nodeVersion":"12.18.1","_npmVersion":"6.14.5","dist":{"integrity":"sha512-jPe/fgm3b2p7Mh7LXyciOpPcCs3k7FJ1h+g2laHn3cOXsaemKY27BjojfofmJj2pW1VsWPGjMRf4S9iRISDHUA==","shasum":"449c7ee091d74d6647a485c0da86c921f77f0134","tarball":"https://registry.npmjs.org/@aspiesoft/async-extra/-/async-extra-0.2.5.tgz","fileCount":5,"unpackedSize":9373,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe+zZVCRA9TVsSAnZWagAAnfYQAJsCbsIRdmu/ZDih3I1K\n3v1nRKWk4oye9Ky/LdQnBmvGXWgsxSAihHDVBcU5Z4dMehHSZHw5NmCP/fxx\nz5Sj8OS+FEmTlYPZvFclvUvl0jBc3mfu/37TMrnkI6ERUzDg2FeqfE9OJGie\nXstbES8u0EmME0zmxlMaoOgE6YHkESVql2nItgP+C2sKmNqlWztfGC7k8Pdb\nhNPVnhnYgjhx1LmFr5qeHSAs53NxpSzLg1pDjSf92Y0WHGlk6QlkPD0Co4z0\nZBeMppqcAnINVDECOOMBG9fZU1A1b7hBuLgmc9b7MdhLfolKpnCaGu3WrXuG\nNh+u9BtZ8AOf1nW+ijfwKNSUwGLmTaOJgw+QSSdEyNZv+4b09wuXbuIlcmIk\nFTfAOepYGSKtCHfO7zgqYbyNozZ3IRXuBIp6n7lFprc5rZF//oGbubp9G0Sc\nWgaxNc/OcfQTlBmCUKCm7tnHzaZrtuFii+CH9vKDKsSCJLiGxGFDG3EwKPMa\nFdedAek5JU4AEoZlMRnseblF60l4VWi4gteXzIQTfSWVi/B5lMKfhRbapcL6\nw/AkYE4aXg5hCOxUe8d66xrauWRU93zzKta3Q6lyrU0QK5YnVCKVcW6/0tOn\nnyysN3tntSQ7TjC4bXhmpNXOKQj7mMz+G3ZejkRAP3L8yKqjyhDwGoXpppNK\nLveS\r\n=fZzj\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEn/d1glSdRHL1ItfyyeVKK15n9hADNkXvRndznCoHDFAiEAudjIjBq+6GtWDwh1/hiMIodLTWQs8qzoBs18aP1jVIg="}]},"maintainers":[{"name":"aspiesoft","email":"aspiesoftweb@gmail.com"}],"_npmUser":{"name":"aspiesoft","email":"aspiesoftweb@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/async-extra_0.2.5_1593521749112_0.7656229254135412"},"_hasShrinkwrap":false},"0.2.6":{"name":"@aspiesoft/async-extra","version":"0.2.6","description":"Some additional functions to advance the capabilities of asynchronous code in javascript.","license":"MIT","author":{"name":"AspieSoft"},"scripts":{"test":"node app.js","build":"node build.js"},"repository":{"type":"git","url":"git://github.com/aspiesoft/async-extra.git"},"main":"index.js","keywords":["async","sync","extra","asynchronous","await","wait for value","async loop","js","javascript","nodejs","synchronous-async"],"devDependencies":{"miniforge-js":"^1.0.0"},"gitHead":"59e471b670afa0425c7fb929d519ebfa92596b80","bugs":{"url":"https://github.com/aspiesoft/async-extra/issues"},"homepage":"https://github.com/aspiesoft/async-extra#readme","_id":"@aspiesoft/async-extra@0.2.6","_nodeVersion":"12.22.12","_npmVersion":"6.14.16","dist":{"integrity":"sha512-0VnUdTm20uaN5cIRM2X/nTb8MlJ0Tix73LSlO0g06uCT/mNBlVZNAFspNZtoNbLCRwMtSafiUVkpsCdj2yDVHQ==","shasum":"da2b6b5f1e4229d2179a6bbbd708bd9b8229eb99","tarball":"https://registry.npmjs.org/@aspiesoft/async-extra/-/async-extra-0.2.6.tgz","fileCount":5,"unpackedSize":9415,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDIl8bBZIamhBZltwKB8iOheiwbB8tNv3IIQt7MMpaWTgIhANAsKq9nuOI0/WtC3glW0EzqCrqPSzbUPFsKEP7g2slD"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi4f58ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoBRhAAojMXNV735+uWdapJcTAU6JNemYkHRGyTDCLLJXxvrCWgmIyR\r\n8+MbXb+oTDCrU/PJuPhF0C+vUMAzL1PasUyY/qJHHhVpzuiV7BEIR8UJccKG\r\n9NWIKYzcVynIaFHwBCyunxULR0fnaqBjEIRWGADtckHC35rMVRkYmERmXa6k\r\nf9ykumXOp/oxGYt/BvvYNm1f6L6X7G7BQFaroHKRvq6LoIZkQPdmqAnZtx8t\r\nBXpMpXHtVrvf3cNocZpGxGSU8CpOMNJS/WAr/opJa5YZUivM98Or5BiWEY7D\r\nZEEJ5E0OjDdQtPs8dJFGawuysRhbFdbX71GCTdjKw29RxuCU3l91kBZr1BZv\r\nv4qcy7sRgLOMrTBj3iNLnjURwrw3zAJRcA/JYuQ3OUdQS13KREbGQSfzWxxj\r\nEkHxtjri/IyusTZginLY5a5a75Tecm4Gowun2Z6IWyyYPC+RmcIAmA1xmFDA\r\nqUoDwEo7gwE23DdWUOgNCICh55ubKnTaBozK2zSJJlza80cD5UuvJAKoMyTb\r\nNHUtVwL6Usfj8ZMtUFJ/khNF7x0dvFjeic8S4R6wA72NQ9U2SC28la3g+CS8\r\nHwVoWFbbTv8XL6FjedHpJgF41GQ3e+v0lUBSDUIAiMzxfJ7NzVuJBnkDE3fw\r\n+My4DaAiMLvUjEE379FMOWo6GKqGxSj8y/k=\r\n=Ab3t\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"aspiesoft","email":"aspiesoftweb@gmail.com"},"directories":{},"maintainers":[{"name":"aspiesoft","email":"aspiesoftweb@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/async-extra_0.2.6_1658977915974_0.8969751743517065"},"_hasShrinkwrap":false},"0.2.7":{"name":"@aspiesoft/async-extra","version":"0.2.7","description":"Some additional functions to advance the capabilities of asynchronous code in javascript.","license":"MIT","author":{"name":"AspieSoft"},"scripts":{"test":"node app.js","build":"node build.js"},"repository":{"type":"git","url":"git://github.com/aspiesoft/async-extra.git"},"main":"index.js","keywords":["async","sync","extra","asynchronous","await","wait for value","async loop","js","javascript","nodejs","synchronous-async"],"devDependencies":{"miniforge-js":"^1.2.2"},"gitHead":"47a186a42db24b7845868e17dae17c1eb3efc6fa","bugs":{"url":"https://github.com/aspiesoft/async-extra/issues"},"homepage":"https://github.com/aspiesoft/async-extra#readme","_id":"@aspiesoft/async-extra@0.2.7","_nodeVersion":"16.20.2","_npmVersion":"8.19.4","dist":{"integrity":"sha512-kFCoe0qDvsM/tTuJCLBJLYme2glhj9dqwNUXV1aIOrzMXE4wcoqL+/ZehDBdLa5tgs4sZcGUHxDE8Eg5EffwaA==","shasum":"c7514f18441ee24ef9a921fd7d94fbccdc52b2d7","tarball":"https://registry.npmjs.org/@aspiesoft/async-extra/-/async-extra-0.2.7.tgz","fileCount":5,"unpackedSize":9547,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD3D1mH267KYm+7PL27HcWKZBxfWfpzF3ClM0ATBtzUOAIhANEJi9DNioShNjlTAPWsQpgWkoueGIvaCrlm7g6XuA+s"}]},"_npmUser":{"name":"aspiesoft","email":"aspiesoftweb@gmail.com"},"directories":{},"maintainers":[{"name":"aspiesoft","email":"aspiesoftweb@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/async-extra_0.2.7_1698282048814_0.8041633706894049"},"_hasShrinkwrap":false}},"time":{"created":"2020-05-23T02:50:15.505Z","0.2.3":"2020-05-23T02:50:15.728Z","modified":"2023-10-26T01:00:49.193Z","0.2.4":"2020-05-23T02:52:22.725Z","0.2.5":"2020-06-30T12:55:49.234Z","0.2.6":"2022-07-28T03:11:56.149Z","0.2.7":"2023-10-26T01:00:49.019Z"},"maintainers":[{"name":"aspiesoft","email":"aspiesoftweb@gmail.com"}],"description":"Some additional functions to advance the capabilities of asynchronous code in javascript.","homepage":"https://github.com/aspiesoft/async-extra#readme","keywords":["async","sync","extra","asynchronous","await","wait for value","async loop","js","javascript","nodejs","synchronous-async"],"repository":{"type":"git","url":"git://github.com/aspiesoft/async-extra.git"},"author":{"name":"AspieSoft"},"bugs":{"url":"https://github.com/aspiesoft/async-extra/issues"},"license":"MIT","readme":"# Async Extra\n\n![npm](https://img.shields.io/npm/v/async-extra)\n![Libraries.io dependency status for latest release](https://img.shields.io/librariesio/release/npm/async-extra)\n![GitHub top language](https://img.shields.io/github/languages/top/aspiesoft/async-extra)\n![NPM](https://img.shields.io/npm/l/async-extra)\n\n![npm](https://img.shields.io/npm/dw/async-extra)\n![npm](https://img.shields.io/npm/dm/async-extra)\n\n[![paypal](https://img.shields.io/badge/buy%20me%20a%20coffee-paypal-blue)](https://buymeacoffee.aspiesoft.com)\n\nSome additional functions to advance the capabilities of asynchronous code in javascript.\n\nEver wanted to do more with javascript async. If you simply use async/await, all your doing is making a function sync itself, but not affecting other functions.\nWhy not instead, start an async process, and await the result later in the function when you actually need it.\nThat's what this module does, it simplifies that process, and adds some additional functions that may be useful.\n\nThis module uses no dependencies, and does not rely on nodejs. It is capable of running in the browser (might add in a future update).\n\nWhat about for loops? Why not make an async version of .map()? Check the rest of this readme file, this function was added to the module.\nThe .map() and .forEach() methods of this module also support objects in the loop (auto running Object.keys()). Strings, numbers, booleans, etc. will also be converted to be in an array.\n\n## Installation\n\n```shell script\nnpm install @aspiesoft/async-extra\n```\n\n## Setup\n\n```js\nconst asyncExtra = require('@aspiesoft/async-extra');\n```\n\n## Usage\n\n```js\nasync function myFunction(){\n\n    let options = {\n        timeout: 3000,\n        checkInterval: 10,\n    };\n\n    let operation = asyncExtra.function(options, myLongProcess1, myLongProcess2, myLongProcess3);\n\n    // do stuff...\n\n    await operation.onFinish((result, index, results, finished) => {\n        // onFinish loops through each result, and runs this callback.\n        // \"result\" is the result of the current callback.\n        // \"index\" is the index of the callback (which matches the order you put your functions in).\n        // \"results\" is the array of results (in order) of all the functions.\n        // finished returns true or false. If timeout runs before all processes are finished, this returns false.\n        // you can run this function again, if finished === false.\n    });\n\n    // an alternative to onFinish\n    let result = await operation.result();\n    console.log(result); // output: {results: [resultArray], finished: true || false, unfinished: number of processes left}\n\n    // if you need some results as soon as possible\n    result = operation.resultSync();\n    console.log(result); // output: same as result(), but a much higher chance for empty results.\n    if(result[0]){\n        //first process finished\n    }\n\n    // to simply try and wait for results to finish\n    await operation.wait();\n\n    // you can also change the timeout at any time\n    operation.setOptions({timeout: 3000, checkInterval: 5});\n    // timeout is the number of milliseconds before the function gives up waiting for a result.\n    // checkInterval is the number of milliseconds to wait between checking if the result is there yet.\n\n    // you can also set the results to use an object type (only works when you first create the operation)\n    operation = asyncExtra.function({resultObject: true}); // results will output {0: result1, 1: result2} instead of [result1, result2]\n\n    // you can get the first available result, and skip waiting for more results\n    result = await operation.firstResult(); // output: {result, index, results, finished, unfinished}\n\n    // you can get a result at a specific index\n    result = await operation.resultIndex(index); // output: {result, index}\n\n    // you can add a function at a specific index\n    operation.addIndex(index, callback);\n}\n\n// other methods\n\n// run an async forEach loop, and wait for it to finish\nawait asyncExtra.forEach(objectOrArray, callback);\n// output: {finished: true || false, unfinished: number of items left}\n\n// run an async map loop, and wait for the results, and if an array, in the same order they were originally in\nawait asyncExtra.map(objectOrArray, callback, {timeout: 5000, checkInterval: 5});\n// output: {result: [resultArray], finished: true || false, unfinished: number of items left}\n\n// make an async function sleep for a number of milliseconds\nawait asyncExtra.sleep(ms);\n\n// the function this module uses to wait for results from async operations\nlet value = false;\n// set value in async function...\nawait asyncExtra.waitForValue(() => value, timeout, checkInterval);\n```\n","readmeFilename":"readme.md"}