Commit Graph

1 Commits

Author SHA1 Message Date
Rick Waldron dfc7ce4c28
Iterator Helpers (#2818)
drop:

property descriptor
name
length
[[Prototype]]
is a function
is not constructible
result instanceof Iterator
limit is given a non-primitive that needs to be converted to a number
  through valueOf
  through toString (array)
limit coercion to number throws
limit converts to NaN
  same as limit not supplied
limit behaves properly
  limit < number of values
  limit = number of values
  limit > number of values
gets the next method from the underlying iterator only once
underlying iterator has throwing next getter
underlying iterator next throws when advancing past dropped items
underlying iterator is advanced after calling drop
underlying iterator is closed after calling drop
underlying iterator is already closed
underlying iterator next returns non-object
underlying iterator next returns object with throwing done/value getters
underlying iterator return is never called when result iterator is closed

every:

property descriptor
name
length
[[Prototype]]
is a function
is callable
is not constructible
result is a Boolean
predicate is non-callable
iterator already exhausted
called on non-object
called on object with "next" method
called on object with non-callable "next" method
predicate returns non-Boolean
predicate returns truthy for all iterated values
  returns true
predicate returns truthy for some iterated values but then falsey for at least one iterated value
  returns false
  iteration stops
  iterator is closed
predicate returns falsey immediately
  returns false
  iteration stops
  iterator is closed
predicate throws
  every throws
  iterator is closed
predicate throws then iterator close also throws
predicate this value is undefined
predicate is passed the yielded value as the first parameter and a counter as second parameter
gets the next method from the iterator only once
iterator has throwing next getter
iterator has throwing return getter
iterator next throws
iterator return throws
iterator next returns non-object
iterator next returns object with throwing done/value getters

Co-authored-by: Michael Ficarra <mficarra@shapesecurity.com>
Co-authored-by: Jordan Harband <ljharb@gmail.com>
2023-06-15 17:07:41 +02:00