@putout/operator-json 3.2.0 → 3.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/README.md +30 -2
- package/lib/json.js +4 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ export const traverse = ({push}) => ({
|
|
|
37
37
|
});
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
### `
|
|
40
|
+
### `__toml`
|
|
41
41
|
|
|
42
42
|
```js
|
|
43
43
|
import {operator} from 'putout';
|
|
@@ -49,6 +49,18 @@ export const traverse = ({push}) => ({
|
|
|
49
49
|
});
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
+
### `__docker`
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
import {operator} from 'putout';
|
|
56
|
+
|
|
57
|
+
const {__docker} = operator;
|
|
58
|
+
|
|
59
|
+
export const traverse = ({push}) => ({
|
|
60
|
+
[__docker]: push,
|
|
61
|
+
});
|
|
62
|
+
```
|
|
63
|
+
|
|
52
64
|
### `__ignore`
|
|
53
65
|
|
|
54
66
|
```js
|
|
@@ -87,7 +99,23 @@ isJSON(`hello({"hello": "world"});`);
|
|
|
87
99
|
false;
|
|
88
100
|
```
|
|
89
101
|
|
|
90
|
-
### `
|
|
102
|
+
### `isTOML(source: string)`
|
|
103
|
+
|
|
104
|
+
```js
|
|
105
|
+
isTOML(`__putout_processor_toml({"hello": "world"});`);
|
|
106
|
+
// returns
|
|
107
|
+
true;
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### `isDocker(source: string)`
|
|
111
|
+
|
|
112
|
+
```js
|
|
113
|
+
isDocker(`__putout_processor_docker(['MAINTAINER', 'abc']);`);
|
|
114
|
+
// returns
|
|
115
|
+
true;
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### `isJSONJGroup(source: string)`
|
|
91
119
|
|
|
92
120
|
```js
|
|
93
121
|
isJSONGroup(`__putout_processor_toml({"hello": "world"});`);
|
package/lib/json.js
CHANGED
|
@@ -12,6 +12,7 @@ const createSuffix = () => ');\n';
|
|
|
12
12
|
const maybeNewline = (a) => a.at(-1) === '\n' ? a : `${a}\n`;
|
|
13
13
|
|
|
14
14
|
export const __json_name = '__putout_processor_json';
|
|
15
|
+
export const __docker_name = '__putout_processor_docker';
|
|
15
16
|
export const __yaml_name = '__putout_processor_yaml';
|
|
16
17
|
export const __toml_name = '__putout_processor_toml';
|
|
17
18
|
export const __filesystem_name = '__putout_processor_filesystem';
|
|
@@ -20,11 +21,13 @@ export const __ignore_name = '__putout_processor_ignore';
|
|
|
20
21
|
export const __json = `${__json_name}(__object)`;
|
|
21
22
|
export const __yaml = `${__yaml_name}(__object)`;
|
|
22
23
|
export const __toml = `${__toml_name}(__object)`;
|
|
24
|
+
export const __docker = `${__docker_name}(__object)`;
|
|
23
25
|
export const __filesystem = `${__filesystem_name}(__object)`;
|
|
24
26
|
export const __ignore = `${__ignore_name}(__array)`;
|
|
25
27
|
|
|
26
28
|
const TYPES = [
|
|
27
29
|
__json_name,
|
|
30
|
+
__docker_name,
|
|
28
31
|
__toml_name,
|
|
29
32
|
__yaml_name,
|
|
30
33
|
__filesystem_name,
|
|
@@ -54,6 +57,7 @@ export const fromJS = (source, name = __json) => {
|
|
|
54
57
|
|
|
55
58
|
export const isJSON = (source) => !source.indexOf(__json_name);
|
|
56
59
|
export const isTOML = (source) => !source.indexOf(__toml_name);
|
|
60
|
+
export const isDocker = (source) => !source.indexOf(__docker_name);
|
|
57
61
|
export const isJSONGroup = (source) => {
|
|
58
62
|
for (const type of TYPES) {
|
|
59
63
|
if (!source.indexOf(type))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/operator-json",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊Putout operator adds ability to work with json",
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
],
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@putout/test": "^15.0.0",
|
|
34
|
-
"
|
|
35
|
-
"eslint": "^10.0.0-alpha.0",
|
|
34
|
+
"eslint": "^10.0.0",
|
|
36
35
|
"eslint-plugin-n": "^17.0.0",
|
|
37
|
-
"eslint-plugin-putout": "^
|
|
38
|
-
"madrun": "^
|
|
36
|
+
"eslint-plugin-putout": "^31.0.0",
|
|
37
|
+
"madrun": "^13.0.0",
|
|
39
38
|
"montag": "^1.2.1",
|
|
40
39
|
"nodemon": "^3.0.1",
|
|
40
|
+
"superc8": "^12.0.0",
|
|
41
41
|
"supertape": "^12.0.0"
|
|
42
42
|
},
|
|
43
43
|
"license": "MIT",
|