14 lines
238 B
JavaScript
14 lines
238 B
JavaScript
'use strict';
|
|
|
|
function createEnum(keys) {
|
|
const obj = {};
|
|
for (const [index, key] of keys.entries()) {
|
|
if (key === null) continue;
|
|
obj[key] = index;
|
|
obj[index] = key;
|
|
}
|
|
return obj;
|
|
}
|
|
|
|
module.exports = { createEnum };
|