UNPKG

@herlinus/coloquent

Version:

Library for retrieving model objects from a JSON-API, with a fluent syntax inspired by Laravel Eloquent.

16 lines 572 B
export class Reflection { static getNameOfNthMethodOffStackTrace(error, n) { const re = /@|at [a-zA-Z0-9\.\/_]+\.([a-zA-Z0-9_]+) \(/g; const stack = error.stack !== undefined ? error.stack : ''; for (let i = 0; i < n - 1; i++) { re.exec(stack); } const results = re.exec(stack); // exec second time and get submatch return (results !== null && results.length >= 2) ? results[1] : undefined; } } //# sourceMappingURL=Reflection.js.map