Skip to content
This repository was archived by the owner on Feb 9, 2018. It is now read-only.

Commit ccd8891

Browse files
committed
Hide next function for iterators
1 parent e4e5184 commit ccd8891

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/util.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,16 @@
7777
*/
7878
function iterator(keys, callback) {
7979
var index = 0;
80-
var result = {
81-
next: function() {
82-
if (index < keys.length) {
83-
var key = keys[index++];
84-
return { done: false, value: callback(key) };
85-
} else {
86-
return { done: true, value: undefined };
87-
}
80+
function _next() {
81+
if (index < keys.length) {
82+
var key = keys[index++];
83+
return { done: false, value: callback(key) };
84+
} else {
85+
return { done: true, value: undefined };
8886
}
87+
}
88+
var result = {
89+
next: _next,
8990
};
9091
result[Symbol.iterator] = function() { return result; };
9192
return result;

0 commit comments

Comments
 (0)