parse-types

1.0.2 • Public • Published

parse-type

Build Status

Parse types of nested javascript strings

Usage

let parse = require('parse-types');

let result;

// String
result = parse("{"test":"1","another":"false","nope":"tru","float":"0.1","nested":{"property":{"number":"10"}},"array":["of","0",{"various":"10","values":"sad"}]}");

// OR

// Object
result = parse({
  test: '1',
  another: 'false',
  nope: 'tru',
  float: '0.1',
  nested: {
    property: {
      number: '10'
    }
  },
  array: [
    'of',
    '0',
    {
      various: '10',
      values: 'sad'
    }
  ]
});

console.log(result);
/*

{
  "test": 1,
  "another": false,
  "nope": "tru",
  "float": 0.1,
  "nested": {
    "property": {
      "number": 10
    }
  },
  "array": [
    "of",
    0,
    {
      "various": 10,
      "values": "sad"
    }
  ]
}

*/


Authors

Readme

Keywords

Package Sidebar

Install

npm i parse-types

Weekly Downloads

1

Version

1.0.2

License

MIT

Last publish

Collaborators

  • johnhof