UNPKG

database-builder

Version:

Library to assist in creating and maintaining SQL commands.

35 lines (34 loc) 1.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MapperUtils = void 0; var IDENTIFIER = '__identifier'; var MapperUtils = /** @class */ (function () { function MapperUtils() { } MapperUtils.resolveKey = function (tKey) { var _a, _b, _c; // returns the string when string if (typeof tKey === 'string') return tKey; // when there's a prototype else if ('prototype' in tKey) return ( // returns the identifier if defined (_b = (_a = tKey.prototype[IDENTIFIER]) !== null && _a !== void 0 ? _a : // or prototype name tKey.prototype.name) !== null && _b !== void 0 ? _b : // or name itself in the last case tKey.name); else return ( // return the constructor's prototype identifier when defined (_c = tKey.constructor.prototype[IDENTIFIER]) !== null && _c !== void 0 ? _c : // or the constructor's name tKey.constructor.name); }; MapperUtils.setIdentifier = function (newable, identifier) { newable.prototype[IDENTIFIER] = identifier; }; return MapperUtils; }()); exports.MapperUtils = MapperUtils;