Last active
August 1, 2018 07:34
-
-
Save ste2425/43053b89bea0505f3f5595779693d68f to your computer and use it in GitHub Desktop.
Close Contacts Enumerator polly-fill
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!window.Enumerator) { | |
window.Enumerator = function (c) { | |
this._c = Array.from(c); | |
this._index = 0; | |
} | |
window.Enumerator.prototype.atEnd = function () { | |
return this._index >= this._c.length - 1; | |
} | |
window.Enumerator.prototype.moveFirst = function () { | |
this._index = 0; | |
} | |
window.Enumerator.prototype.moveNext = function () { | |
if (this._index >= (this._c.length - 1)) | |
this._index = (this._c.length - 1); | |
else { | |
this._index += 1; | |
} | |
} | |
window.Enumerator.prototype.item = function () { | |
return this._c[this._index]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment