optional-results
v0.0.5
Published
A package that check if an operation, usually functions call, is successful. It returns true or false depending on the operation
Downloads
4
Maintainers
Readme
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}