Skip to content

Commit

Permalink
build: 3.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosCarmona committed Feb 27, 2021
1 parent 97b7da4 commit cac03b5
Show file tree
Hide file tree
Showing 6 changed files with 1,551 additions and 164 deletions.
15 changes: 12 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"env": {
"browser": true,
"node": true
},
"extends": ["plugin:prettier/recommended"],
Expand All @@ -9,7 +8,7 @@
"global": true
},
"parserOptions": {
"ecmaVersion": 2020,
"ecmaVersion": 2021,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
Expand All @@ -19,6 +18,16 @@
"indent": ["error", 2, { "SwitchCase": 1 }],
"default-case": "error",
"linebreak-style": ["error", "unix"],
"semi": ["error", "always"]
"semi": ["error", "always"],
"no-console": "error",
"no-undef": "error",
"no-var": "error",
"no-caller": "error",
"no-throw-literal": "error",
"no-unneeded-ternary": "error",
"prefer-const": "error",
"comma-spacing": ["error", { "before": false, "after": true }],
"comma-style": ["error", "last"],
"handle-callback-err": ["error", "^(err|error)$"]
}
}
6 changes: 2 additions & 4 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
node_modules
.all-contributorsrc
.eslintignore
.gitignore
.prettierignore
.npmignore
LICENSE
*.png
*.txt
TODO
docs/functions.md
*.md
test.log
.DS_Store
26 changes: 18 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
<a href="http://runnerty.io">
<img height="257" src="https://runnerty.io/assets/header/logo-stroked.png">
</a>
<p align="center">A new way for processes managing</p>
<p align="center">Smart Processes Management</p>
</p>

[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Dependency Status][david-badge]][david-badge-url]
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Dependency Status][david-badge]][david-badge-url]
<a href="#badge">
<img alt="code style: prettier" src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg">
<img alt="code style: prettier" src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg">
</a>

# XML/JSON Parser executor for [Runnerty]:

### Installation:

Through NPM

```bash
Expand All @@ -34,6 +35,7 @@ rty add @runnerty/executor-parse-xml-json
```

### Configuration sample:

```json
{
"id": "parse-xml-json_default",
Expand All @@ -42,9 +44,10 @@ rty add @runnerty/executor-parse-xml-json
```

### Plan sample:

```json
{
"id":"parse-xml-json_default",
"id": "parse-xml-json_default",
"to": "xml",
"json": {
"title": "Hello world",
Expand All @@ -55,30 +58,32 @@ rty add @runnerty/executor-parse-xml-json

```json
{
"id":"parse-xml-json_default",
"id": "parse-xml-json_default",
"to": "json",
"xml": "<?xml version='1.0' encoding='UTF-8' standalone='yes'?><root><title>Hello world</title><description>Example for XML/JSON parser executor</description></root>"
}
```

### Plan sample using input files:

```json
{
"id":"parse-xml-json_default",
"id": "parse-xml-json_default",
"to": "xml",
"json_file": "./test/sample.json"
}
```

```json
{
"id":"parse-xml-json_default",
"id": "parse-xml-json_default",
"to": "json",
"xml_file": "./test/sample.xml"
}
```

### Plan sample using output file:

```json
{
"id": "parse-xml-json_default",
Expand All @@ -89,6 +94,7 @@ rty add @runnerty/executor-parse-xml-json
```

### Plan sample using options object for json:

```json
{
"id": "parse-xml-json_default",
Expand All @@ -101,7 +107,9 @@ rty add @runnerty/executor-parse-xml-json
}
}
```

### Plan sample using options object for xml:

```json
{
"id": "parse-xml-json_default",
Expand All @@ -114,13 +122,15 @@ rty add @runnerty/executor-parse-xml-json
}
}
```

Options definitions for `json_options` and `xml_options` params can be found here:

- [json_options]
- [xml_options]

[json_options]: https://github.com/Leonidas-from-XIV/node-xml2js#options
[xml_options]: https://github.com/Leonidas-from-XIV/node-xml2js#options-for-the-builder-class
[Runnerty]: http://www.runnerty.io
[runnerty]: http://www.runnerty.io
[downloads-image]: https://img.shields.io/npm/dm/@runnerty/executor-parse-xml-json.svg
[npm-url]: https://www.npmjs.com/package/@runnerty/executor-parse-xml-json
[npm-image]: https://img.shields.io/npm/v/@runnerty/executor-parse-xml-json.svg
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ class parseXmlJsonExecutor extends Executor {
}

async exec(params) {
let endOptions = { end: 'end' };
const endOptions = { end: 'end' };

async function parseToJson(xml) {
try {
const parser = new xml2js.Parser(params.json_options);
const result = await parser.parseStringPromise(xml);
resolve(JSON.stringify(result));
return JSON.stringify(result);
} catch (err) {
throw err;
}
Expand Down
Loading

0 comments on commit cac03b5

Please sign in to comment.