Skip to content

Instantly share code, notes, and snippets.

@oriSomething
Last active February 24, 2019 08:08
Show Gist options
  • Save oriSomething/16a16d8ea12573307dc6 to your computer and use it in GitHub Desktop.
Save oriSomething/16a16d8ea12573307dc6 to your computer and use it in GitHub Desktop.
build enums with lodash
import _ from 'lodash';
export function enumNumber(... params) {
return Object.freeze(_.mapValues(_.invert(params), Number));
}
export function enumString(... params) {
return Object.freeze(_.mapKeys(params));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment