1.1.5 • Published 6 years ago

@grigorecezar/utils v1.1.5

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

Codeship Status for wagel/utils

Utils

A small library that has common code to be shared across wagel modules. It currently supports error handling / errors, middlewares and common API methods.

Installation

List tokens: npm token list Create token: npm token create --read-only Delete token: npm token delete

Read more

https://docs.npmjs.com/getting-started/working_with_tokens

https://docs.npmjs.com/files/npmrc

"utils": "git+https://874d51582870893d902b28357b46aea94f83b653:x-oauth-basic@github.com/wagel/utils.git"

http://blog.npmjs.org/post/118393368555/deploying-with-npm-private-modules

`http://blog.npmjs.org/post/118393368555/deploying-with-npm-private-modules

Usage

Errors module

const utils = require('utils')

const errors = utils.errors

  • Throw errors

    throw new errors.ValidationError('Password too short.')

    throw new errors.AuthError('Wrong credentials.')

    throw new errors.BadRequestError('Email field is missing.')

    throw new errors.InternalFailureError('Something went wrong.')

    Middleware module

    const utils = require('utils')

    const middlewares = utils.middlewares

  • Register error handler

    middlewares.errorHandler(app)(process.env.NODE_ENV)

    API wrapper module

    const utils = require('utils') const wagelAPI = utils.wagelAPI

Tests

npm test

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago