coercer

1.1.2 • Public • Published

The Coercer

Turns objects/arrays full of strings of numbers and booleans into primitives.

Installation

npm install --save coercer

Usage

var coercer = require('coercer')
 
coerce({
  'foo': 'true',
  'bar': '5',
  'baz': 'hello',
  'qux': {
    'quux': 'eight'
   },
   'corge': ['7', '93.2', 'false'],
   'grault': true,
   'garply': false
  })
 
// returns
{
  'foo': true,
  'bar': 5,
  'baz': 'hello',
  'qux': {
    'quux': 'eight'
  },
  'corge': [7, 93.2, false],
  'grault': true,
  'garply': false
}

Readme

Keywords

none

Package Sidebar

Install

npm i coercer

Weekly Downloads

11,881

Version

1.1.2

License

ISC

Last publish

Collaborators

  • achingbrain