range.js 384 B

12345678910111213
  1. /**
  2. * @license
  3. * Copyright 2021 Google LLC
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. export function* range(startOrEnd, end, step = 1) {
  7. const start = end === undefined ? 0 : startOrEnd;
  8. end !== null && end !== void 0 ? end : (end = startOrEnd);
  9. for (let i = start; step > 0 ? i < end : end < i; i += step) {
  10. yield i;
  11. }
  12. }
  13. //# sourceMappingURL=range.js.map