source: imaps-frontend/node_modules/lodash-es/next.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 834 bytes
Line 
1import toArray from './toArray.js';
2
3/**
4 * Gets the next value on a wrapped object following the
5 * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
6 *
7 * @name next
8 * @memberOf _
9 * @since 4.0.0
10 * @category Seq
11 * @returns {Object} Returns the next iterator value.
12 * @example
13 *
14 * var wrapped = _([1, 2]);
15 *
16 * wrapped.next();
17 * // => { 'done': false, 'value': 1 }
18 *
19 * wrapped.next();
20 * // => { 'done': false, 'value': 2 }
21 *
22 * wrapped.next();
23 * // => { 'done': true, 'value': undefined }
24 */
25function wrapperNext() {
26 if (this.__values__ === undefined) {
27 this.__values__ = toArray(this.value());
28 }
29 var done = this.__index__ >= this.__values__.length,
30 value = done ? undefined : this.__values__[this.__index__++];
31
32 return { 'done': done, 'value': value };
33}
34
35export default wrapperNext;
Note: See TracBrowser for help on using the repository browser.