presidium 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Docker.js +1 -1
- package/XML.js +21 -3
- package/package.json +1 -1
package/Docker.js
CHANGED
package/XML.js
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
* @name XML
|
|
3
3
|
*
|
|
4
4
|
* @docs
|
|
5
|
-
*
|
|
6
|
-
* XML object
|
|
7
|
-
* ```
|
|
5
|
+
* Presidium XML class.
|
|
8
6
|
*/
|
|
9
7
|
const XML = {}
|
|
10
8
|
|
|
@@ -253,6 +251,26 @@ function _convert(ast) {
|
|
|
253
251
|
* XML.parse(xml string) -> data NestedObject
|
|
254
252
|
* XML.parse(xml string, options { ast: true }) -> ast RootAST
|
|
255
253
|
* ```
|
|
254
|
+
*
|
|
255
|
+
* Parses [XML](https://en.wikipedia.org/wiki/XML) into JSON data.
|
|
256
|
+
*
|
|
257
|
+
* Arguments:
|
|
258
|
+
* * `xml` - an XML string.
|
|
259
|
+
* * `options`
|
|
260
|
+
* * `ast` - whether to return an AST (Abstract Syntax Tree) of the XML string.
|
|
261
|
+
*
|
|
262
|
+
* Return:
|
|
263
|
+
* * `data` - the JSON data parsed from the `xml` string, or if `ast` is true, the AST (Abstract Syntax Tree) of the XML string.
|
|
264
|
+
*
|
|
265
|
+
* ```javascript
|
|
266
|
+
* const data = XML.parse(`
|
|
267
|
+
* <Example a="1">
|
|
268
|
+
* <Attr>Content</Attr>
|
|
269
|
+
* </Example>
|
|
270
|
+
* `)
|
|
271
|
+
*
|
|
272
|
+
* console.log(data) // { Example: { Attr: 'Content', a: '1' } }
|
|
273
|
+
* ```
|
|
256
274
|
*/
|
|
257
275
|
XML.parse = function parse(xml, options = {}) {
|
|
258
276
|
xml = xml.replace(/\n/g, '')
|