/*! For license information please see ca464c2d.903f95bb.js.LICENSE.txt */
"use strict";(self.webpackChunkweb_totals=self.webpackChunkweb_totals||[]).push([[5589],{69983:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var r=s(85893),n=s(11151);const o={sidebar_position:1,title:"Sleep Sort",comment:!0,tags:["Javascript","sort"]},a=void 0,i={id:"javascripts/sort/sleep-sort",title:"Sleep Sort",description:"",source:"@site/issues/javascripts/sort/sleep-sort.md",sourceDirName:"javascripts/sort",slug:"/javascripts/sort/sleep-sort",permalink:"/issues/javascripts/sort/sleep-sort",draft:!1,unlisted:!1,editUrl:"https://github.com/hunghg255/web-totals/tree/main/issues/javascripts/sort/sleep-sort.md",tags:[{label:"Javascript",permalink:"/issues/tags/javascript"},{label:"sort",permalink:"/issues/tags/sort"}],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1,title:"Sleep Sort",comment:!0,tags:["Javascript","sort"]},sidebar:"tutorialSidebar",previous:{title:"Split Text Utils",permalink:"/issues/javascripts/split-text-utils"},next:{title:"useStateProxy",permalink:"/issues/reactjs/custom-hook/use-state-proxy"}},l={},c=[];function p(e){const t={code:"code",pre:"pre",...(0,n.a)(),...e.components};return(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:"async function sleepSort(arr) {\n  const r = [];\n\n  const promises = arr.map(\n    (n) =>\n      new Promise((resolve) =>\n        setTimeout(() => {\n          r.push(n);\n          resolve(null);\n        }, n),\n      ),\n  );\n\n  await Promise.all(promises);\n\n  return r;\n}\n"})})}function u(e={}){const{wrapper:t}={...(0,n.a)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},75251:(e,t,s)=>{var r=s(67294),n=Symbol.for("react.element"),o=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,i=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,s){var r,o={},c=null,p=null;for(r in void 0!==s&&(c=""+s),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(p=t.ref),t)a.call(t,r)&&!l.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===o[r]&&(o[r]=t[r]);return{$$typeof:n,type:e,key:c,ref:p,props:o,_owner:i.current}}t.Fragment=o,t.jsx=c,t.jsxs=c},85893:(e,t,s)=>{e.exports=s(75251)},11151:(e,t,s)=>{s.d(t,{Z:()=>i,a:()=>a});var r=s(67294);const n={},o=r.createContext(n);function a(e){const t=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:a(e.components),r.createElement(o.Provider,{value:t},e.children)}}}]);