package.json
8.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
{
"_args": [
[
{
"raw": "js2xmlparser@~3.0.0",
"scope": null,
"escapedName": "js2xmlparser",
"name": "js2xmlparser",
"rawSpec": "~3.0.0",
"spec": ">=3.0.0 <3.1.0",
"type": "range"
},
"/Users/fzy/project/koa2_Sequelize_project/node_modules/jsdoc"
]
],
"_from": "js2xmlparser@>=3.0.0 <3.1.0",
"_id": "js2xmlparser@3.0.0",
"_inCache": true,
"_location": "/js2xmlparser",
"_nodeVersion": "6.5.0",
"_npmOperationalInternal": {
"host": "packages-18-east.internal.npmjs.com",
"tmp": "tmp/js2xmlparser-3.0.0.tgz_1487737489541_0.49048339668661356"
},
"_npmUser": {
"name": "michaelkourlas",
"email": "michael@kourlas.net"
},
"_npmVersion": "4.2.0",
"_phantomChildren": {},
"_requested": {
"raw": "js2xmlparser@~3.0.0",
"scope": null,
"escapedName": "js2xmlparser",
"name": "js2xmlparser",
"rawSpec": "~3.0.0",
"spec": ">=3.0.0 <3.1.0",
"type": "range"
},
"_requiredBy": [
"/jsdoc"
],
"_resolved": "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-3.0.0.tgz",
"_shasum": "3fb60eaa089c5440f9319f51760ccd07e2499733",
"_shrinkwrap": null,
"_spec": "js2xmlparser@~3.0.0",
"_where": "/Users/fzy/project/koa2_Sequelize_project/node_modules/jsdoc",
"author": {
"name": "Michael Kourlas",
"email": "michael@kourlas.net"
},
"bugs": {
"url": "https://github.com/michaelkourlas/node-js2xmlparser/issues"
},
"dependencies": {
"xmlcreate": "^1.0.1"
},
"description": "Parses JavaScript objects into XML",
"devDependencies": {
"@types/chai": "^3.4.35",
"@types/mocha": "^2.2.39",
"chai": "^3.5.0",
"del": "^2.2.2",
"gulp": "^3.9.1",
"gulp-mocha": "^4.0.1",
"gulp-sourcemaps": "^2.4.1",
"gulp-tslint": "^7.1.0",
"gulp-typedoc": "^2.0.2",
"gulp-typescript": "^3.1.5",
"merge2": "^1.0.3",
"mocha": "^3.2.0",
"tslint": "^4.4.2",
"typedoc": "^0.5.7",
"typescript": "^2.1.6"
},
"directories": {},
"dist": {
"shasum": "3fb60eaa089c5440f9319f51760ccd07e2499733",
"tarball": "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-3.0.0.tgz"
},
"files": [
"lib",
"CHANGES.md",
"LICENSE.md",
"NOTICE.md",
"package.json",
"README.md"
],
"gitHead": "debf3ad08ca3f8795e0498a2a84a4390d0f6fc50",
"homepage": "https://github.com/michaelkourlas/node-js2xmlparser#readme",
"keywords": [
"convert",
"converter",
"javascript",
"js",
"json",
"object",
"objects",
"parse",
"parser",
"xml"
],
"license": "Apache-2.0",
"main": "./lib/main.js",
"maintainers": [
{
"name": "michaelkourlas",
"email": "michaelkourlas@gmail.com"
}
],
"name": "js2xmlparser",
"optionalDependencies": {},
"readme": "# js2xmlparser #\r\n\r\n[](https://travis-ci.org/michaelkourlas/node-js2xmlparser)\r\n[](https://badge.fury.io/js/js2xmlparser)\r\n\r\n## Overview ##\r\n\r\njs2xmlparser is a Node.js module that parses JavaScript objects into XML.\r\n\r\n## Features ##\r\n\r\nSince XML is a data-interchange format, js2xmlparser is designed primarily for \r\nJSON-type objects, arrays and primitive data types, like many of the other \r\nJavaScript to XML parsers currently available for Node.js.\r\n\r\nHowever, js2xmlparser is capable of parsing any object, including native \r\nJavaScript objects such as `Date` and `RegExp`, by taking advantage of each\r\nobject's `toString` function or, if this function does not exist, the `String`\r\nconstructor.\r\n\r\njs2xmlparser also has support for the new `Map` and `Set` objects introduced in\r\nECMAScript 2015, treating them as JSON-type objects and arrays respectively.\r\nSupport for `Map`s is necessary to generate XML with elements in a specific\r\norder, since JSON-type objects do not guarantee insertion order. `Map` keys are \r\nalways converted to strings using the method described above.\r\n\r\njs2xmlparser also supports a number of constructs unique to XML:\r\n\r\n* attributes (through an attribute property in objects)\r\n* mixed content (through value properties in objects)\r\n* multiple elements with the same name (through arrays)\r\n\r\njs2xmlparser can also pretty-print the XML it outputs.\r\n\r\n## Installation ##\r\n\r\nThe easiest way to install js2xmlparser is using npm:\r\n\r\n```\r\nnpm install js2xmlparser\r\n```\r\n\r\nYou can also build js2xmlparser from source using gulp:\r\n\r\n```\r\ngit clone https://github.com/michaelkourlas/node-js2xmlparser.git\r\nnpm install\r\ngulp\r\n```\r\n\r\nYou'll need to install gulp first if you don't have it:\r\n\r\n```\r\nnpm install -g gulp\r\n```\r\n\r\nYou can then copy the folder into your node_modules directory.\r\n\r\nThe `default` target will build the production variant of js2xmlparser, run all\r\ntests, and build the documentation.\r\n\r\nYou can build the production variant without running tests using the target\r\n`prod`. You can also build the development version using the target `dev`. At\r\nthe moment, the only difference between the two is that the development version\r\nincludes source maps.\r\n\r\n## Usage ##\r\n\r\nThe documentation for the current version is available [here](http://www.kourlas.com/node-js2xmlparser/docs/3.0.0/).\r\n\r\nYou can also build the documentation using gulp:\r\n\r\n```\r\ngulp docs\r\n```\r\n\r\n## Examples ##\r\n\r\nThe following example illustrates the basic usage of js2xmlparser:\r\n\r\n```javascript\r\nvar js2xmlparser = require(\"js2xmlparser\");\r\n\r\nvar obj = {\r\n \"firstName\": \"John\",\r\n \"lastName\": \"Smith\",\r\n \"dateOfBirth\": new Date(1964, 7, 26),\r\n \"address\": {\r\n \"@\": {\r\n \"type\": \"home\"\r\n },\r\n \"streetAddress\": \"3212 22nd St\",\r\n \"city\": \"Chicago\",\r\n \"state\": \"Illinois\",\r\n \"zip\": 10000\r\n },\r\n \"phone\": [\r\n {\r\n \"@\": {\r\n \"type\": \"home\"\r\n },\r\n \"#\": \"123-555-4567\"\r\n },\r\n {\r\n \"@\": {\r\n \"type\": \"cell\"\r\n },\r\n \"#\": \"890-555-1234\"\r\n },\r\n {\r\n \"@\": {\r\n \"type\": \"work\"\r\n },\r\n \"#\": \"567-555-8901\"\r\n }\r\n ],\r\n \"email\": \"john@smith.com\"\r\n};\r\n\r\nconsole.log(js2xmlparser.parse(\"person\", obj));\r\n```\r\n\r\nThis example produces the following XML:\r\n\r\n```xml\r\n<?xml version='1.0'?>\r\n<person>\r\n <firstName>John</firstName>\r\n <lastName>Smith</lastName>\r\n <dateOfBirth>Wed Aug 26 1964 00:00:00 GMT-0400 (Eastern Summer Time)</dateOfBirth>\r\n <address type='home'>\r\n <streetAddress>3212 22nd St</streetAddress>\r\n <city>Chicago</city>\r\n <state>Illinois</state>\r\n <zip>10000</zip>\r\n </address>\r\n <phone type='home'>123-555-4567</phone>\r\n <phone type='cell'>890-555-1234</phone>\r\n <phone type='work'>567-555-8901</phone>\r\n <email>john@smith.com</email>\r\n</person>\r\n```\r\n\r\nAdditional examples can be found in examples/example.js.\r\n\r\n## Tests ##\r\n\r\njs2xmlparser includes a set of tests to verify core functionality. You can run\r\nthe tests using gulp:\r\n\r\n```\r\ngulp test\r\n```\r\n\r\nThe `test` target builds the production variant of js2xmlparser before running\r\nthe tests. The `test-prod` target does the same thing, while the `test-dev`\r\ntarget builds the development variant first instead.\r\n\r\n## License ##\r\n\r\njs2xmlparser is licensed under the [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).\r\nPlease see the LICENSE.md file for more information.\r\n",
"readmeFilename": "README.md",
"repository": {
"type": "git",
"url": "git://github.com/michaelkourlas/node-js2xmlparser.git"
},
"scripts": {},
"typings": "./lib/main",
"version": "3.0.0"
}