asde

1.0.3 • Public • Published

SYNOPSIS

A low level module for destructuring asynchronous values.

MOTIVATION

async helps solve promise hell and provides a sync-like way to receive values, but doesn't include a similar way to receive errors. asde is a simple, low level promise wrapper that returns both error and values as an array to which destructuring assignment can identify the values.

USAGE

const asde = require('asde')
const fs = require('fs')
 
const stat = asde(fs.stat)
 
async function main () {
  const [errStat, value] = await stat('./file')
 
  if (errStat) {
    return console.error(errStat)
  }
 
  console.log(value)
}
 
main()

INSTALL

npm install asde

Readme

Keywords

none

Package Sidebar

Install

npm i asde

Weekly Downloads

2

Version

1.0.3

License

ISC

Last publish

Collaborators

  • hij1nx