Przeglądaj źródła

Docs: Improved docs in nth function.

Maciej Bukowski 8 lat temu
rodzic
commit
80b0c5855f
1 zmienionych plików z 3 dodań i 1 usunięć
  1. 3 1
      packages/ckeditor5-utils/src/nth.js

+ 3 - 1
packages/ckeditor5-utils/src/nth.js

@@ -10,7 +10,9 @@
 /**
  * Returns `nth` (starts from `0` of course) item of the given `iterable`.
  * Consumes all items of the generator.
- * Consumes all items up to the index of the iterator, including the returned item.
+ * Consumes all items up to the index of the iterator that doesn't implement the `return()` method, (e.g. Array Iterator).
+ * It's necessary to implement the `return()` method to close the iterator after the return statement in the `nth` function is invoked.
+ * @see http://www.ecma-international.org/ecma-262/7.0/#sec-iteratorclose.
  *
  * @param {Number} index
  * @param {Iterable.<*>} iterable