Skip to content

Instantly share code, notes, and snippets.

@domenic
Created April 27, 2019 06:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save domenic/17d0d9102c7c1fba6f0df9a71061942d to your computer and use it in GitHub Desktop.
Save domenic/17d0d9102c7c1fba6f0df9a71061942d to your computer and use it in GitHub Desktop.
  1. Let O be this value.
  2. If Type(O) is not Object or O does not have all the internal slots of a %AsyncIteratorPrototypeMapIteratorPrototype% Instance, return ! PromiseReject(a newly created TypeError object).
  3. Let mapper be O.[[Mapper]].
  4. Let iterated be O.[[Iterated]].
  5. Let result be SubMap(iterated, v).
  6. If result is an abrupt completion, return PromiseReject(result.[[Value]]).
  7. Return PromiseResolve(result.[[Value]]).

SubMap(iterated, v)

  1. Let nextPromise be ? IteratorNext(iterated, v)
  2. Let next be ? Await(nextPromise)
  3. Let done be ? IteratorComplete(next)
  4. If done is true, then return ! CreateIterResultObject(undefined, true)
  5. Let value be ? IteratorValue(next).
  6. Let mapped be ? Await(? Call(mapper, undefined, « value »)).
  7. Return CreateIterResultObject(mapped, false).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment