qb-type-format

1.0.1 • Public • Published

qb-type-format

Function for converting type objects or portions of type objects into concise strings. The end result is still valid JSON, but with some objects converted to flat-strings.

For example:

var format = require('qb-type-format')

var obj = {
    a: [ 'string', 'foo', { k: 'hi' } ],
    b: 'item b',
    c: { nested: 'object' }
}

console.log('Plain', JSON.stringify(obj, null, '  '))
console.log('Formatted', JSON.stringify(format(obj), null, '  '))

Outputs:

Plain: {
  "a": [
    "string",
    "foo",
    {
      "k": "hi"
    }
  ],
  "b": "item b",
  "c": {
    "nested": "object"
  }
}
Formatted: {
  "a": "[string,foo,{k:hi}]",
  "b": "item b",
  "c": "{nested:object}"
}

install

npm i qb-type-format

Package Sidebar

Install

npm i qb-type-format

Weekly Downloads

0

Version

1.0.1

License

ISC

Unpacked Size

7.98 kB

Total Files

5

Last publish

Collaborators

  • mvoss9000