object-parser
Multiple parse/stringify function
Last updated 5 years ago by 59naga .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install object-parser 
SYNC missed versions from official npm registry.

Object-parser NPM version Build Status Coverage Status

Sauce Test Status

Multiple parse/stringify function

Installation

Via npm

$ npm install object-parser --save
var OP= require('object-parser');
console.log(OP); //object

Via bower

$ bower install object-parser --save
<script src="bower_components/object-parser/object-parser.min.js"></script>
<script>
  console.log(OP); //object
</script>

API

OP.stringify(type,object,replacer,indent)

var object= [['foo',{bar:'baz'},['beep','boop']]];

OP.stringify('yaml',object);
// '-\n    - foo\n    - {bar: baz}\n    - [beep, boop]'

OP.stringify('json',object);
// '[["foo",{"bar":"baz"},["beep","boop"]]]'

OP.stringify('json5',object);
// '[["foo",{bar:"baz"},["beep","boop"]]]'

OP.stringify('jsonml',object);
// '<foo bar="baz"><beep>boop</beep></foo>'

OP.parse(type,object)

OP.parse('yaml','-\n    - foo\n    - {bar: baz}\n    - [beep, boop]\n');
// [
//   [
//     "foo",
//     {
//       "bar": "baz"
//     },
//     [
//       "beep",
//       "boop"
//     ]
//   ]
// ]

OP.parse('json','[["foo",{"bar":"baz"},["beep","boop"]]]');
// [
//   [
//     "foo",
//     {
//       "bar": "baz"
//     },
//     [
//       "beep",
//       "boop"
//     ]
//   ]
// ]

OP.parse('json5','[["foo",{bar:"baz"},["beep","boop"]]]');
// [
//   [
//     "foo",
//     {
//       "bar": "baz"
//     },
//     [
//       "beep",
//       "boop"
//     ]
//   ]
// ]

OP.parse('jsonml','<foo bar="baz"><beep>boop</beep></foo>');
// [
//   [
//     "foo",
//     {
//       "bar": "baz"
//     },
//     [
//       "beep",
//       "boop"
//     ]
//   ]
// ]

License

MIT

Current Tags

  • 0.0.1                                ...           latest (5 years ago)

7 Versions

  • 0.0.1                                ...           5 years ago
  • 0.0.1-alpha.3                                ...           5 years ago
  • 0.0.1-alpha.2                                ...           5 years ago
  • 0.0.1-alpha.1                                ...           5 years ago
  • 0.0.1-alpha.0                                ...           5 years ago
  • 0.0.0                                ...           5 years ago
  • 0.0.0-beta.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 7
This Month 7
Last Day 7
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (9)

Copyright 2014 - 2016 © taobao.org |