TryCatch
tryCatch()
function exampleFunction(st){
return st;
}
const result = tryCatch(exampleFunction, 'this is a string');
result // '[null, 'this is a string']'
if(result[0] === null){
console.log(result[1]) // 'this is a string'
}
tryCatch()
function exampleFunction(st){
return st;
}
const result = tryCatch(exampleFunction, 'this is a string');
result // '[null, 'this is a string']'
if(result[0] === null){
console.log(result[1]) // 'this is a string'
}
npm i @aaronburt/try
2
1.1.1
MIT
1.88 kB
6