0.2.18 • Published 1 month ago

@trenskow/fail-silently v0.2.18

Weekly downloads
-
License
BSD-2-Clause
Repository
github
Last release
1 month ago

@trenskow/fail-silently

A simple function wrapper for ignoring errors thrown.

Usage

You wrap the function you want to ignore errors thrown from as the example below.

const
	failSilently = require('@trenskow/fail-silently');

function myThrowingFunction(shouldThrow) {
    if (shouldThrow) throw new Error("This is my error.");
    return 'Hello, World!';
}

failSilently(myThrowingFunction)(false); // -> 'Hello, World!'
failSilently(myThrowingFunction)(true); // -> undefined

It also works with async functions.

LICENSE

See license in LICENSE

0.2.18

1 month ago

0.2.17

1 month ago

0.2.16

2 months ago

0.2.15

3 months ago

0.2.14

4 months ago

0.2.13

4 months ago

0.2.12

4 months ago

0.2.11

4 months ago

0.2.10

6 months ago

0.2.9

6 months ago

0.2.8

7 months ago

0.2.7

8 months ago

0.2.6

8 months ago

0.2.5

1 year ago

0.2.3

1 year ago

0.1.14

1 year ago

0.1.15

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.10

2 years ago

0.1.11

2 years ago

0.1.12

1 year ago

0.1.13

1 year ago

0.1.8

2 years ago

0.1.9

2 years ago

0.1.7

2 years ago

0.1.4

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.2

3 years ago

0.1.3

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago