tm-result

0.1.0 • Public • Published

tm-result

npm codecov

Return and process results of functions or api calls as a JS object.

The common result object format is

{ status, result, [data], [messages] }
  • status String with possible two values 'ok' or 'nok'(means not ok).
  • result String which should be equal to 'ok' if status is 'ok', or should contain details about why result is not ok.
  • data could be any value and contains a result data.
  • messages Array of messages for 'nok' results(can be passed as a rest arguments to the genNOk method).

Installation

npm i tm-result

Functions

  • genOk Generates 'OK' result object.
  • genNOk Generates 'not OK' result object.
  • isOk Checks if passed arg is an 'OK' result object.
  • isNOk Checks if passed arg is a 'not OK' result object.

Readme

Keywords

Package Sidebar

Install

npm i tm-result

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

9.29 kB

Total Files

6

Last publish

Collaborators

  • romon2002