Last active
October 22, 2015 03:15
-
-
Save yasuhiro-okada-aktsk/8c5a85181faa27a603b0 to your computer and use it in GitHub Desktop.
js:each
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
function Each(obj, fn) { | |
if (obj.length) for (var i = 0, ol = obj.length, v = obj[0]; i < ol && fn(v, i) !== false; v = obj[++i]); | |
else for (var p in obj) if (fn(obj[p], p) === false) break; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment