Created
March 22, 2019 19:22
-
-
Save miguelmota/021a84516c21fc71f043d0f988eb5866 to your computer and use it in GitHub Desktop.
Node.js iota (Golang iota equivalent)
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
const iota = (() => { let n = 0; return () => n++ })() | |
const myEnum = { | |
foo: iota(), // 0 | |
bar: iota(), // 1 | |
baz: iota(), // 2 | |
qux: iota(), // 3 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you want to set the start index: