0.1.0 • Published 3 years ago
tm-result v0.1.0
tm-result
Return and process results of functions or api calls as a JS object.
The common result object format is
{ status, result, [data], [messages] }statusString with possible two values 'ok' or 'nok'(means not ok).resultString which should be equal to 'ok' ifstatusis 'ok', or should contain details about why result is not ok.datacould be any value and contains a result data.messagesArray of messages for 'nok' results(can be passed as a rest arguments to the genNOk method).
Installation
npm i tm-result
Functions
genOkGenerates 'OK' result object.genNOkGenerates 'not OK' result object.isOkChecks if passed arg is an 'OK' result object.isNOkChecks if passed arg is a 'not OK' result object.