Merge pull request #258 from cazou/fix-split-on-undefined

Avoid split on undefined
This commit is contained in:
Julien Catania 2023-10-09 19:24:04 +02:00 committed by GitHub
commit f3a6ff2ed4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

4
dist/index.js generated vendored
View file

@ -2198,8 +2198,8 @@ function parseIsoDate(str) {
}
exports.parseIsoDate = parseIsoDate;
function getFirstNonEmptyLine(stackTrace) {
const lines = stackTrace.split(/\r?\n/g);
return lines.find(str => !/^\s*$/.test(str));
const lines = stackTrace === null || stackTrace === void 0 ? void 0 : stackTrace.split(/\r?\n/g);
return lines === null || lines === void 0 ? void 0 : lines.find(str => !/^\s*$/.test(str));
}
exports.getFirstNonEmptyLine = getFirstNonEmptyLine;

View file

@ -19,6 +19,6 @@ export function parseIsoDate(str: string): Date {
}
export function getFirstNonEmptyLine(stackTrace: string): string | undefined {
const lines = stackTrace.split(/\r?\n/g)
return lines.find(str => !/^\s*$/.test(str))
const lines = stackTrace?.split(/\r?\n/g)
return lines?.find(str => !/^\s*$/.test(str))
}