0.0.5 • Published 2 years ago

optional-results v0.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Optional-results

First import the library

const optionalResults = require('optional-results')

Destructure the optionalResults to get function "checkForResult"

const {checkForResult} = optionalResults

Next, define your funtion. This is the function you want to check for its result.

function tester(number){ return number * 2 }

Test the execustion of the function by wrapping it in checkForResult

let result = checkForResult(number, 2)

result will be object of {success: boolean, value: any}