Created
January 8, 2014 17:08
-
-
Save st98/8320341 to your computer and use it in GitHub Desktop.
JavaScriptで列挙型みたいなもの。
This file contains hidden or 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 () { | |
| var slice = [].slice; | |
| var Enum = function () { | |
| var args = slice.call(arguments); | |
| var count, len; | |
| var result = {}; | |
| for (count = 0, len = args.length; count < len; count += 1) { | |
| result[args[count]] = count; | |
| } | |
| return result; | |
| }; | |
| this.Enum = Enum; | |
| }).call(this); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment