nralcm
Version:
This is a framework based on NodeJs to manage rest api request lifecycle
20 lines (19 loc) • 727 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Method to get constructor parameter names
* @param target class Object
*/
function getConstructorParameters(target) {
const classString = target.toString();
let constructorParameters = [];
const constructorIndex = classString.indexOf("constructor");
if (classString && constructorIndex !== -1) {
let args = classString.substr(constructorIndex);
args = args.substring(args.indexOf("(") + 1, args.indexOf(")"));
if (args.length)
constructorParameters = args.replace(/ /g, "").split(",");
}
return constructorParameters;
}
exports.getConstructorParameters = getConstructorParameters;