Skip to content

Instantly share code, notes, and snippets.

View AndresSepar's full-sized avatar
🤖
Coding mode!

Andres Separ AndresSepar

🤖
Coding mode!
View GitHub Profile
@AndresSepar
AndresSepar / Enum.js
Last active February 11, 2022 04:43
Javascript (ES6) Enum
export class Enum {
isObject (o) {
return (!!o) && (o.constructor === Object);
}
isArray (a) {
return (!!a) && (a.constructor === Array);
}
flipObject (o) {
return Object.entries(o).reduce((obj, [key, value]) => ({ ...obj, [value]: key }), {})
}