{"name":"promise-all-reject-late","version":"1.0.1","description":"Like Promise.all, but save rejections until all promises are resolved","author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"https://izs.me"},"license":"ISC","scripts":{"test":"tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags"},"tap":{"check-coverage":true},"devDependencies":{"tap":"^14.10.5"},"funding":{"url":"https://github.com/sponsors/isaacs"},"gitHead":"c892a9db86650c9229ab4cc70395106684d6818a","_id":"promise-all-reject-late@1.0.1","_nodeVersion":"12.14.1","_npmVersion":"6.13.6","dist":{"integrity":"sha512-vuf0Lf0lOxyQREH7GDIOUMLS7kz+gs8i6B+Yi8dC68a2sychGrHTJYghMBD6k7eUcH0H5P73EckCA48xijWqXw==","shasum":"f8ebf13483e5ca91ad809ccc2fcf25f26f8643c2","tarball":"http://registry-npm.ywwl.com/promise-all-reject-late/download/promise-all-reject-late-1.0.1.tgz","fileCount":8,"unpackedSize":123171,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeL65kCRA9TVsSAnZWagAAas4P/2WFFJvncp0LWb3DbE0t\ndx9BhZEwY3W8V6ug8uKvph24LoQp1PakkncscKS7PsCVHyIslD+fi6V99AmI\nOmL2ECAMUd5N69Cs8eTi4tKTNtUoIslfCu0+SMlCAF11D7oBXSabdOxGQofA\nuksoHdCqGM6M1y2BGjK7FR8dSwvgbQCPaUzazZ5w7w4XqVxDlzbvNj2E5mSF\n5HjlT5q239uNQppwPIFpisyi9DKa0ran2N7F2ioZ1PHvhFCqo6rmL8tAQsxQ\n+3OA4eFD0FJCJuqd3MOaY66mkncfNpmPvQYMyigKBUdJJyrgNsB67yfaFduy\ndK198Bnva5kotttQ4EHxM6gkqRm2d9o1/sYmAUtDELgrVDxzeNl+yG+nCkho\n1ta4cY+wy1dTjqAYaprQJ855nIeGGnr3tvz4dEGX/5eyh5K+oYVOYRFvWFX6\nVlEhBmSRqamfW5N1ndMyY18FM+Vc12yu66yZ3z1FqbgEGqdf3EP3lwWqClpP\nbPdXANzHM1FIz1PGHC7IZFWXH5KV1z+JXXahg/d8CLzz0PY6jaBt4c2xDvo7\nLaEAm7kNMbdewKvuTuG7x2Kqyf1KwjpOhXMrq6h0rlFm0pRt0xAArQ9Sglw8\n2Vq9Ic9EEsSIpzA5iQ86O1xkTREGHTB3uTRXUJixXIGkhLkhBB+Uj9y+GoOh\nX+Dm\r\n=yF+m\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF/1IP4kLDnU4PHzmimyai0AZOnjgZsFngMy8XugjyxMAiEA7bBDYTX+R5q/e2pxOakvYMskOvSWpktdo4HidEzZijM="}],"size":30838,"noattachment":false,"key":"/promise-all-reject-late/-/promise-all-reject-late-1.0.1.tgz"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"_npmUser":{"name":"isaacs","email":"i@izs.me"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/promise-all-reject-late_1.0.1_1580183139628_0.5159334029276426"},"_hasShrinkwrap":false,"readme":"# promise-all-reject-late\n\nLike Promise.all, but save rejections until all promises are resolved.\n\nThis is handy when you want to do a bunch of things in parallel, and\nrollback on failure, without clobbering or conflicting with those parallel\nactions that may be in flight.  For example, creating a bunch of files,\nand deleting any if they don't all succeed.\n\nExample:\n\n```js\nconst lateReject = require('promise-all-reject-late')\n\nconst { promisify } = require('util')\nconst fs = require('fs')\nconst writeFile = promisify(fs.writeFile)\n\nconst createFilesOrRollback = (files) => {\n  return lateReject(files.map(file => writeFile(file, 'some data')))\n    .catch(er => {\n      // try to clean up, then fail with the initial error\n      // we know that all write attempts are finished at this point\n      return lateReject(files.map(file => rimraf(file)))\n        .catch(er => {\n          console.error('failed to clean up, youre on your own i guess', er)\n        })\n        .then(() => {\n          // fail with the original error\n          throw er\n        })\n    })\n}\n```\n\n## API\n\n* `lateReject([array, of, promises])` - Resolve all the promises,\n  returning a promise that rejects with the first error, or resolves with\n  the array of results, but only after all promises are settled.\n","publish_time":1580183139762,"_cnpm_publish_time":1580183139762,"dist-tags":{"latest":"1.0.1"}}