1.0.12 • Published 10 years ago

utility-tool v1.0.12

Weekly downloads
3
License
ISC
Repository
github
Last release
10 years ago

utility-tool on CodeShip

ToC

Sections
Semantic Versioning
Installation
Usage

Semantic Versioning

Back to ToC

  • If you're not familiar with semantic versioning; or, just need some brushing up, head on over to http://semver.org/.

Installation

Back to ToC

Using command line:

  1. Navigate to your project's root.

  2. Type the following command:

$ npm i --save utility-tool
  1. Include the module in each script used.
const utilityTool = require('utility-tool');

Usage

Back to ToC

  • debug(msg = null, obj = null, errLevel = 1, httpCode = null)

    • Important

      • When starting your application from command line, you must include the argument:
      DEBUG=true

      Example Usage:

      $ DEBUG=true npm start
    • Description

      • Displays robust debug messages in terminal.
    • Code Examples

      • Display an Error Message:
      utilityTool.debug('there was an error');
      • Example Result:
      • Display a Success Message:
      utilityTool.debug('there was not an error', null, 0);
      • Example Result:
    • Parameters

      • msg - String, default null

        • A message to print to the console.
      • obj - Object, default null

        • An object to print to the console.

        • Is converted to JSON.

      • errLevel - Integer, default 1

        • If errLevel is not a truthy value, msg will have a green background, else it will have a red background.
      • httpCode - Integer, default null

        • Will append the httpCode to msg.
  • isNumber(n, failure, success)

    • Description

      • Tests to see if a variable is a number.
    • Code Example

    utilityTool.isNumber(5, (n) =>{
      utilityTool.debug(`${n} is not a number`);
    }, (n) => {
      utilityTool.debug(`${n} is a number`);
    });
    • Parameters

      • n - required, Mixed

        • The variable to test.
      • failure(n) - required, Function

        • n will be the value that was tested.

        • What to do if n is not a number.

      • success(n) - required, Function

        • n will be the value that was tested.

        • What to do if n is a number.

1.0.12

10 years ago

1.0.11

10 years ago

1.0.10

10 years ago

1.0.9

10 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago