Common elements that are shared between Five Bells components
Clone or download
dappelt
dappelt Merge pull request #198 from interledgerjs/da-update-dep
fix: update vulnerable dependency
Latest commit 74cc0f3 Jan 9, 2018
Permalink
Failed to load latest commit information.
bin chore: move five-bells repos to interledgerjs Oct 16, 2016
docs/assets [TASK] Add an initial README. May 24, 2015
errors feat: make errors more declarative Nov 14, 2017
lib fix: adds additional exception details if invalid schema is parsed Feb 24, 2017
middlewares feat: make errors more declarative Nov 14, 2017
schemas feat(schemas): add fulfillment-with-data schema Nov 22, 2017
scripts chore: move five-bells repos to interledgerjs Oct 16, 2016
services fix: browser-safe schema loading Dec 8, 2016
test feat: remove json signing (unused feature) Nov 27, 2016
testHelpers [TASK] Deprecate services/log.js. Aug 6, 2015
utils fix: reduce absurdly large password hash size Nov 30, 2016
.eslintignore chore: lint fixes May 5, 2016
.eslintrc [TASK] Switch to JavaScript Standard Style (and enforce) Jul 12, 2015
.gitignore chore: Adds integration-test/ to .gitignore Dec 2, 2016
.npmignore [FEATURE] Add .npmignore Oct 15, 2015
CONTRIBUTING.md chore: update license Nov 2, 2016
LICENSE chore: update license Nov 2, 2016
README.md feat: remove json signing (unused feature) Nov 27, 2016
circle.yml chore: node version 7 Apr 27, 2017
index.js feat: remove json signing (unused feature) Nov 27, 2016
jsdoc.json chore: auto-update gh-pages May 28, 2016
npmrc-env [TASK] Make npmrc handling consistent with other projects. May 21, 2015
package-lock.json fix: update vulnerable dependency Jan 5, 2018
package.json fix: update vulnerable dependency Jan 5, 2018
wallaby.js [TASK] Add Wallaby.js support. Oct 16, 2015

README.md

Five Bells Shared npm circle codecov

Shared module among Five Bells Node.js apps

Installation

npm install --save five-bells-shared

Schema Validator

This module contains a schema validator.

Log Service

The log service uses mag and a custom formatter to generate pretty logs like this:

Example log output

Usage

Set up the logger somewhere in your top-level app:

const hub = require('mag-hub')
const mag = require('mag')
const log = require('five-bells-shared/lib/log')

module.exports = log(mag, hub)

Then use it from anywhere using require('mag'):

const log = require('mag')('transfers')

log.debug('very boring information')
log.info('somewhat useful information')
log.warn('sort of important information')
log.error('super-important information')

Caveat

If you're using mag in a module which is npm linked, it will receive its own instance of mag and messages will not be formatted correctly. To solve this problem, you can install the mag module globally and link it in all of your local modules:

sudo npm install -g mag
npm link mag # in each module directory

Log Test Helper

The log helper is useful in tests to mute the log output of tests and print it if the test fails.

Usage

const logHelper = require('five-bells-shared/testHelpers/log');

describe('Transfers', function () {
  logHelper();

  // ...
});