diff options
author | 2022-08-04 21:59:48 +0200 | |
---|---|---|
committer | 2022-08-04 21:59:48 +0200 | |
commit | f54223fb0aaedbd101b5d3dc4176053533bb936a (patch) | |
tree | 7c34fb3c3aff23a88ef03052d66d1507f33cf7f0 /src/utils/boolean.ts | |
parent | b38ab82d05147b3c7452e79c6edb07e2ced18267 (diff) | |
download | it-tools-f54223fb0aaedbd101b5d3dc4176053533bb936a.tar.gz it-tools-f54223fb0aaedbd101b5d3dc4176053533bb936a.tar.zst it-tools-f54223fb0aaedbd101b5d3dc4176053533bb936a.zip |
refactor(validation): simplified validation management with helpers
Diffstat (limited to '')
-rw-r--r-- | src/utils/boolean.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/utils/boolean.ts b/src/utils/boolean.ts new file mode 100644 index 0000000..9e842ea --- /dev/null +++ b/src/utils/boolean.ts @@ -0,0 +1,10 @@ +export { isNotThrowing }; + +function isNotThrowing(cb: () => unknown): boolean { + try { + cb(); + return true; + } catch (_) { + return false; + } +} |