join.js 457 B

12345678910111213141516171819
  1. /**
  2. * @license
  3. * Copyright 2021 Google LLC
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. export function* join(items, joiner) {
  7. const isFunction = typeof joiner === 'function';
  8. if (items !== undefined) {
  9. let i = -1;
  10. for (const value of items) {
  11. if (i > -1) {
  12. yield isFunction ? joiner(i) : joiner;
  13. }
  14. i++;
  15. yield value;
  16. }
  17. }
  18. }
  19. //# sourceMappingURL=join.js.map