diff options
| author | Andrej Mihajlov <and@codeispoetry.ru> | 2017-02-13 16:39:16 +0000 |
|---|---|---|
| committer | Andrej Mihajlov <and@codeispoetry.ru> | 2017-02-13 16:39:16 +0000 |
| commit | 91c10ffcf4c0577507970d71f1d21f4a7de51196 (patch) | |
| tree | 219391f63056dd7e3495a9decd57663a0a454650 /app/lib/enum.js | |
| parent | 958f44741b463ba1437826e91da7c75c44cc28b9 (diff) | |
| download | mullvadvpn-91c10ffcf4c0577507970d71f1d21f4a7de51196.tar.xz mullvadvpn-91c10ffcf4c0577507970d71f1d21f4a7de51196.zip | |
Simulate login
Diffstat (limited to 'app/lib/enum.js')
| -rw-r--r-- | app/lib/enum.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/app/lib/enum.js b/app/lib/enum.js new file mode 100644 index 0000000000..bc8e4b54aa --- /dev/null +++ b/app/lib/enum.js @@ -0,0 +1,20 @@ +import assert from 'assert'; + +/** + * Creates enum object with keys provided as arguments + */ +export default function Enum() { + let object = {}; + + for(const key of arguments) { + Object.defineProperty(object, key, { + enumerable: true, + value: key, + writable: false + }); + } + + Object.freeze(object); + + return object; +}; |
