Archived
1
0

feat: add tests for src/node/app.ts

This commit is contained in:
Joe Previte
2021-09-13 14:35:12 -07:00
parent 4f3c8a556e
commit a3cea88f51
4 changed files with 322 additions and 14 deletions

View File

@ -524,3 +524,12 @@ export function escapeHtml(unsafe: string): string {
.replace(/"/g, """)
.replace(/'/g, "'")
}
/**
* A helper function which returns a boolean indicating whether
* the given error is a NodeJS.ErrnoException by checking if
* it has a .code property.
*/
export function isNodeJSErrnoException(error: unknown): error is NodeJS.ErrnoException {
return error instanceof Error && (error as NodeJS.ErrnoException).code !== undefined
}