4.0.2 • Published 3 years ago

@replygirl/tc v4.0.2

Weekly downloads
34
License
ISC
Repository
github
Last release
3 years ago

tc

node-current (scoped) GitHub top language Libraries.io dependency status for latest release, scoped npm package Maintainability Test Coverage GitHub issues GitHub pull requests

destructurable, async-friendly try...catch wrapper function with support for error side effects and fallback values

Installation & usage

See the docs for full details.

import tc from '@replygirl/tc'

// get the return value and error of a try callback
const [x, e] = tc(() => { /* ... */ })

// or put complex error handling in a catch callback
const [y] = await tc(doSomething, async e => {
  await reportError(e)
  return getFallbackValue(e)
})

// reuse your error handling by defining your own wrapper
const tce = (t, c) => tc(t, async e => {
  await reportError(e)
  return c(e)
})
const [z] = tce(doSomething, getFallbackValue)

ISC License | Copyright © 2020–present replygirl

4.0.2

3 years ago

4.0.1

3 years ago

4.0.0

3 years ago

3.0.0

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.1.10

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.1.2

4 years ago

1.0.1

4 years ago