0.2.10 • Published 28 days ago

@trenskow/fail-silently v0.2.10

Weekly downloads
-
License
BSD-2-Clause
Repository
github
Last release
28 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.10

28 days ago

0.2.9

1 month ago

0.2.8

2 months ago

0.2.7

3 months ago

0.2.6

3 months ago

0.2.5

9 months ago

0.2.3

9 months ago

0.1.14

10 months ago

0.1.15

10 months ago

0.2.1

10 months ago

0.2.0

10 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

2 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