0.2.14 • Published 3 days ago

@trenskow/fail-silently v0.2.14

Weekly downloads
-
License
BSD-2-Clause
Repository
github
Last release
3 days 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.14

3 days ago

0.2.13

14 days ago

0.2.12

14 days ago

0.2.11

14 days ago

0.2.10

2 months ago

0.2.9

2 months ago

0.2.8

3 months ago

0.2.7

4 months ago

0.2.6

4 months ago

0.2.5

10 months ago

0.2.3

11 months ago

0.1.14

11 months ago

0.1.15

11 months ago

0.2.1

11 months ago

0.2.0

11 months ago

0.1.10

1 year ago

0.1.11

1 year ago

0.1.12

1 year ago

0.1.13

1 year ago

0.1.8

1 year ago

0.1.9

1 year 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