4.0.2 • Published 2 years ago

@replygirl/tc v4.0.2

Weekly downloads
34
License
ISC
Repository
github
Last release
2 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

2 years ago

4.0.1

3 years ago

4.0.0

3 years ago

3.0.0

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.1.10

3 years ago

1.1.9

3 years ago

1.1.8

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.1.2

3 years ago

1.0.1

3 years ago