0.1.8 • Published 6 years ago

@ministryofjustice/fb-utils-node v0.1.8

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

fb-utils-node

Form Builder utility methods

Installing

npm install @ministryofjustice/fb-utils-node

Usage

const FBUtils = require('@ministryofjustice/fb-utils-node')

Methods

logger

FBUtils.logger(...args)

clone

Returns a shallow copy of any object

const clonedObj = FBUtils.clone(obj)

Objects can be of any type.

By default, the object copy is shallow.

To create a deep copy, pass true:

const deeplyClonedObj = FBUtils.clone(obj, true)

FBError

Base class for errors

class MyError extends FBError {}

throw new MyError('An error occurred', {
  data: additionalData
})

Testing

npm test
# Test output is in [TAP](https://testanything.org/) format

Run unit tests only

npm run test:unit

Run linting only

npm run lint