code: function takeLast(count) {
      return function* (iterable) {
          const buffer = [];
          for (const item of iterable) {
              buffer.push(item);
              if (buffer.length > count) {
                  buffer.shift();
              }
          }
          return yield* buffer;
      };
  }
docs: Take only the last N items in an iterable sequence