{"_id":"@expo/mux","_rev":"55-c5f9e82267fae08a4354703df54c47c9","name":"@expo/mux","dist-tags":{"latest":"1.0.7"},"versions":{"1.0.6":{"name":"@expo/mux","version":"1.0.6","keywords":["promise","async","await","multiplex","mux","nested","deep","recursive"],"author":{"name":"James Ide"},"license":"MIT","_id":"@expo/mux@1.0.6","maintainers":[{"name":"ide","email":"ide+npm@jameside.com"}],"homepage":"https://github.com/ide/mux","bugs":{"url":"https://github.com/ide/mux/issues"},"dist":{"shasum":"591b7b3ae64849991a05186414e0ecbd5f06b271","tarball":"https://registry.npmjs.org/@expo/mux/-/mux-1.0.6.tgz","integrity":"sha512-T87FlL09id53OBeThD22soeE7TC8UPBOTRETYs4Ttn7CxRF35luwYXcHNPS5w6nMhByTGfkU9Jc7Oizykfmj9w==","signatures":[{"sig":"MEYCIQDxReMy4tFF8VxcMm1Y2EGBnPxIwET7aPyKzbRFHGbGLQIhAPd6J6sfKxiPoUme9aJds3z7Bw5xyv+2HQCnJNSR/oVp","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"jest":{"rootDir":"src"},"main":"build/mux.js","_from":".","babel":{"plugins":["add-module-exports","transform-async-to-generator","transform-es2015-modules-commonjs","transform-flow-strip-types"]},"files":["build/"],"_shasum":"591b7b3ae64849991a05186414e0ecbd5f06b271","gitHead":"c50ed750c43ea7d7872ed5607197e04125add4f8","scripts":{"flow":"flow","test":"jest","babel":"babel","build":"./build.sh","prepublish":"yarn run build"},"_npmUser":{"name":"ide","email":"ide+npm@jameside.com"},"repository":{"url":"git+https://github.com/ide/mux.git","type":"git"},"_npmVersion":"4.1.2","description":"Creates a promise that waits for the promises in nested data structures and resolves to data structures of the same form. It recursively traverses the input data structure and multiplexes its promises.","directories":{},"_nodeVersion":"7.7.1","dependencies":{"lodash":"^4.17.4"},"devDependencies":{"jest":"^19.0.2","flow-bin":"^0.43.1","babel-cli":"^6.24.1","babel-jest":"^19.0.0","babel-plugin-add-module-exports":"^0.2.1","babel-plugin-transform-flow-strip-types":"^6.22.0","babel-plugin-transform-async-to-generator":"^6.24.1","babel-plugin-transform-es2015-modules-commonjs":"^6.24.1"},"_npmOperationalInternal":{"tmp":"tmp/mux-1.0.6.tgz_1491600810408_0.4141729262191802","host":"packages-12-west.internal.npmjs.com"}},"1.0.7":{"name":"@expo/mux","version":"1.0.7","keywords":["promise","async","await","multiplex","mux","nested","deep","recursive"],"author":{"name":"James Ide"},"license":"MIT","_id":"@expo/mux@1.0.7","maintainers":[{"name":"wilzh40","email":"wilzh40@gmail.com"},{"name":"jesseruder","email":"jesse@sixfivezero.net"},{"name":"terribleben","email":"ben@exp.host"},{"name":"ccheever","email":"ccheever@gmail.com"},{"name":"dikaiosune","email":"adam.n.perry@gmail.com"},{"name":"nikki93","email":"s.nikhilesh@gmail.com"},{"name":"brentvatne","email":"brentvatne@gmail.com"},{"name":"skevy","email":"adam@sk3vy.com"},{"name":"ide","email":"ide+npm@jameside.com"},{"name":"expoadmin","email":"exponent.team@gmail.com"}],"homepage":"https://github.com/ide/mux","bugs":{"url":"https://github.com/ide/mux/issues"},"dist":{"shasum":"77a29dcf7bd02edf76cfc74631a64ea6b13b9c58","tarball":"https://registry.npmjs.org/@expo/mux/-/mux-1.0.7.tgz","integrity":"sha512-HJGYCv03mUq9wnW4DvmcBU3Y5SpKEwng7rwRr05SawiIfUr743qMwJQRtCYpC1m98nWmKFjq5ca5Qq/fMq+WFA==","signatures":[{"sig":"MEQCIDNaNI4V/JiykvLIi50zyFvQMIJjN9DFYXqud+f+A+7ZAiA3BSx/xwO3Xk2XibknDhzWgsZVUGvjT971tCcf7/gyYw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"jest":{"rootDir":"src"},"main":"build/mux.js","files":["build/"],"gitHead":"75e5e26343453a7da5ab99341b65ecba8398faf9","scripts":{"flow":"flow","test":"jest","babel":"babel","build":"./build.sh","prepare":"yarn run build"},"_npmUser":{"name":"ide","email":"ide+npm@jameside.com"},"repository":{"url":"git+https://github.com/ide/mux.git","type":"git"},"_npmVersion":"5.3.0","description":"Creates a promise that waits for the promises in nested data structures and resolves to data structures of the same form. It recursively traverses the input data structure and multiplexes its promises.","directories":{},"_nodeVersion":"8.4.0","dependencies":{"lodash":"^4.17.4"},"devDependencies":{"jest":"^20.0.4","flow-bin":"^0.53.1","babel-cli":"^6.26.0","babel-jest":"^20.0.3","babel-plugin-add-module-exports":"^0.2.1","babel-plugin-transform-flow-strip-types":"^6.22.0","babel-plugin-transform-async-to-generator":"^6.24.1","babel-plugin-transform-es2015-modules-commonjs":"^6.26.0"},"_npmOperationalInternal":{"tmp":"tmp/mux-1.0.7.tgz_1503302766311_0.26280000852420926","host":"s3://npm-registry-packages"}}},"time":{"created":"2017-04-07T21:33:30.714Z","modified":"2026-09-23T11:26:36.028Z","1.0.6":"2017-04-07T21:33:30.714Z","1.0.7":"2017-08-21T08:06:06.428Z"},"bugs":{"url":"https://github.com/ide/mux/issues"},"author":{"name":"James Ide"},"license":"MIT","homepage":"https://github.com/ide/mux","keywords":["promise","async","await","multiplex","mux","nested","deep","recursive"],"repository":{"url":"git+https://github.com/ide/mux.git","type":"git"},"description":"Creates a promise that waits for the promises in nested data structures and resolves to data structures of the same form. It recursively traverses the input data structure and multiplexes its promises.","maintainers":[{"email":"ide+npm@jameside.com","name":"ide"},{"email":"brentvatne@gmail.com","name":"brentvatne"},{"email":"support@expo.io","name":"expoadmin"},{"email":"exponent.team@gmail.com","name":"exponent"},{"email":"me@bycedric.com","name":"bycedric"},{"email":"ckchien@gmail.com","name":"kudochien"},{"email":"hughesno1@gmail.com","name":"alanhughes"},{"email":"npm@tsapeta.com","name":"tsapeta"},{"email":"brent+expobotnpm@expo.io","name":"expo-bot"},{"email":"phil@kitten.sh","name":"philpl"},{"email":"ccheever@gmail.com","name":"ccheever"},{"email":"sz.dziedz@gmail.com","name":"szdziedzic"},{"email":"wschurman@gmail.com","name":"wschurman"}],"readme":"# mux [![CircleCI](https://circleci.com/gh/ide/mux.svg?style=svg)](https://circleci.com/gh/ide/mux) [![codecov](https://codecov.io/gh/ide/mux/branch/master/graph/badge.svg)](https://codecov.io/gh/ide/mux)\nA simple and convenient function that resolves promises in data structures like arrays, objects, Maps, and Sets\n\n## What is mux?\n\nMux is a function that multiplexes promises in nested data structures and resolves them like this:\n\n```js\nawait mux({\n  a: asyncFunction1(),\n  b: asyncFunction2(),\n});\n\n// Result:\n{\n  a: result1,\n  b: result2,\n}\n```\n\n## Installing mux\n\n```sh\nyarn add @expo/mux\n```\n\nAnd import it like this:\n\n```js\nimport mux from '@expo/mux';\n```\n\n## More examples\n\nYou can also pass in deeply nested data structures like this:\n\n```js\nawait mux({\n  a: {\n    b: asyncFunction1(),\n  },\n});\n\n// Result:\n{\n  a: {\n    b: result1,\n  },\n}\n```\n\nMux supports several standard JavaScript data structures:\n\n```js\nawait mux(new Set([\n  asyncFunction1(),\n  asyncFunction2(),\n]));\n\n// Result:\nnew Set([\n  result1,\n  result2,\n])\n```\n\nAnd if your promises themselves result in data structures, mux will recurse into them and resolve the nested promises.\n\n```js\nawait mux([\n  Promise.resolve({\n    a: asyncFunction1(),\n  }),\n]);\n\n// Result:\n[\n  {\n    a: result1,\n  },\n]\n```\n\nCheck out [the test suite](src/__tests__/mux-tests.js) for even more examples.\n\n## Interesting use cases\n\nIf you've discovered a particularly interesting way to use mux, add it here and send a PR to share it.\n","readmeFilename":"README.md"}