UNPKG

@lordfokas/magic-orm

Version:

A class-based ORM in TypeScript. Unorthodox and extremely opinionated, made to fit my specific use cases.

20 lines 665 B
Promise.prototype.first = async function first(fallback) { const array = await this; if (!Array.isArray(array)) throw new Error("Called first on a Promise not of type Promise<any[]>"); return (array.length > 0) ? array[0] : (fallback || null); }; Object.defineProperty(Object.prototype, 'isHigherOrder', { 'enumerable': false, 'value': function isHigherOrder() { for (const value of Object.values(this)) { if (value instanceof Object) return true; if (Array.isArray(value)) return true; } return false; } }); export {}; //# sourceMappingURL=Hacks.js.map