json10 13.1.36 → 13.1.37

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.
@@ -1,2 +1,2 @@
1
- export * from './lib';
1
+ export * from './lib';
2
2
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3RtcC1saWJzLWZvci1idW5kbGUvanNvbjEwL3Byb2plY3RzL2pzb24xMC9zcmMvcHVibGljLWFwaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLE9BQU8sQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vbGliJztcbiJdfQ==
@@ -2,59 +2,59 @@ import { _ } from 'tnp-core/browser';
2
2
  import { walk } from 'lodash-walk-object/browser';
3
3
  import { CLASS } from 'typescript-class-helpers/browser';
4
4
 
5
- class JSON10 {
6
- static structureArray(anyJSON, options) {
7
- let pathes = [];
8
- const { include, exclude } = options || {};
9
- walk.Object(anyJSON, (value, lodashPath) => {
10
- if (!_.isUndefined(value)) {
11
- pathes.push(lodashPath);
12
- }
13
- }, { include, exclude, checkCircural: true });
14
- return pathes;
15
- }
16
- static cleaned(json, onCircs, options) {
17
- const result = _.isArray(json) ? [] : {};
18
- const classFN = CLASS.OBJECT(json).isClassObject && CLASS.getFromObject(json);
19
- const { exclude, include, breadthWalk } = options || { exclude: [], include: [], breadthWalk: false };
20
- const { circs } = walk.Object(json, (value, lodashPath, changeValueTo, options) => {
21
- if (_.isObject(value) && options.isCircural) {
22
- _.set(result, lodashPath, null);
23
- }
24
- else {
25
- _.set(result, lodashPath, _.cloneDeep(value));
26
- }
27
- }, { include, exclude, breadthWalk, checkCircural: true });
28
- if (_.isFunction(onCircs)) {
29
- onCircs(circs);
30
- }
31
- return _.isFunction(classFN) ? _.merge(new classFN(), result) : result;
32
- }
33
- static stringify(anyJSON, replace, spaces, onCircs) {
34
- const json = this.cleaned(anyJSON, onCircs);
35
- return JSON.stringify(json, replace, spaces);
36
- }
37
- static parse(json, circs = []) {
38
- let res = JSON.parse(json);
39
- if (_.isArray(circs)) {
40
- circs.forEach(({ circuralTargetPath, pathToObj }) => {
41
- if (circuralTargetPath === '') {
42
- _.set(res, pathToObj, res);
43
- }
44
- else {
45
- let v = _.get(res, circuralTargetPath);
46
- _.set(res, pathToObj, v);
47
- }
48
- });
49
- }
50
- return res;
51
- }
52
- }
53
- ;
5
+ class JSON10 {
6
+ static structureArray(anyJSON, options) {
7
+ let pathes = [];
8
+ const { include, exclude } = options || {};
9
+ walk.Object(anyJSON, (value, lodashPath) => {
10
+ if (!_.isUndefined(value)) {
11
+ pathes.push(lodashPath);
12
+ }
13
+ }, { include, exclude, checkCircural: true });
14
+ return pathes;
15
+ }
16
+ static cleaned(json, onCircs, options) {
17
+ const result = _.isArray(json) ? [] : {};
18
+ const classFN = CLASS.OBJECT(json).isClassObject && CLASS.getFromObject(json);
19
+ const { exclude, include, breadthWalk } = options || { exclude: [], include: [], breadthWalk: false };
20
+ const { circs } = walk.Object(json, (value, lodashPath, changeValueTo, options) => {
21
+ if (_.isObject(value) && options.isCircural) {
22
+ _.set(result, lodashPath, null);
23
+ }
24
+ else {
25
+ _.set(result, lodashPath, _.cloneDeep(value));
26
+ }
27
+ }, { include, exclude, breadthWalk, checkCircural: true });
28
+ if (_.isFunction(onCircs)) {
29
+ onCircs(circs);
30
+ }
31
+ return _.isFunction(classFN) ? _.merge(new classFN(), result) : result;
32
+ }
33
+ static stringify(anyJSON, replace, spaces, onCircs) {
34
+ const json = this.cleaned(anyJSON, onCircs);
35
+ return JSON.stringify(json, replace, spaces);
36
+ }
37
+ static parse(json, circs = []) {
38
+ let res = JSON.parse(json);
39
+ if (_.isArray(circs)) {
40
+ circs.forEach(({ circuralTargetPath, pathToObj }) => {
41
+ if (circuralTargetPath === '') {
42
+ _.set(res, pathToObj, res);
43
+ }
44
+ else {
45
+ let v = _.get(res, circuralTargetPath);
46
+ _.set(res, pathToObj, v);
47
+ }
48
+ });
49
+ }
50
+ return res;
51
+ }
52
+ }
53
+ ;
54
54
  ({}); // @--end-of-file-for-module=json10 lib/index.ts
55
55
 
56
- /**
57
- * Generated bundle index. Do not edit.
56
+ /**
57
+ * Generated bundle index. Do not edit.
58
58
  */
59
59
 
60
60
  export { JSON10 };
@@ -2,59 +2,59 @@ import { _ } from 'tnp-core/browser';
2
2
  import { walk } from 'lodash-walk-object/browser';
3
3
  import { CLASS } from 'typescript-class-helpers/browser';
4
4
 
5
- class JSON10 {
6
- static structureArray(anyJSON, options) {
7
- let pathes = [];
8
- const { include, exclude } = options || {};
9
- walk.Object(anyJSON, (value, lodashPath) => {
10
- if (!_.isUndefined(value)) {
11
- pathes.push(lodashPath);
12
- }
13
- }, { include, exclude, checkCircural: true });
14
- return pathes;
15
- }
16
- static cleaned(json, onCircs, options) {
17
- const result = _.isArray(json) ? [] : {};
18
- const classFN = CLASS.OBJECT(json).isClassObject && CLASS.getFromObject(json);
19
- const { exclude, include, breadthWalk } = options || { exclude: [], include: [], breadthWalk: false };
20
- const { circs } = walk.Object(json, (value, lodashPath, changeValueTo, options) => {
21
- if (_.isObject(value) && options.isCircural) {
22
- _.set(result, lodashPath, null);
23
- }
24
- else {
25
- _.set(result, lodashPath, _.cloneDeep(value));
26
- }
27
- }, { include, exclude, breadthWalk, checkCircural: true });
28
- if (_.isFunction(onCircs)) {
29
- onCircs(circs);
30
- }
31
- return _.isFunction(classFN) ? _.merge(new classFN(), result) : result;
32
- }
33
- static stringify(anyJSON, replace, spaces, onCircs) {
34
- const json = this.cleaned(anyJSON, onCircs);
35
- return JSON.stringify(json, replace, spaces);
36
- }
37
- static parse(json, circs = []) {
38
- let res = JSON.parse(json);
39
- if (_.isArray(circs)) {
40
- circs.forEach(({ circuralTargetPath, pathToObj }) => {
41
- if (circuralTargetPath === '') {
42
- _.set(res, pathToObj, res);
43
- }
44
- else {
45
- let v = _.get(res, circuralTargetPath);
46
- _.set(res, pathToObj, v);
47
- }
48
- });
49
- }
50
- return res;
51
- }
52
- }
53
- ;
5
+ class JSON10 {
6
+ static structureArray(anyJSON, options) {
7
+ let pathes = [];
8
+ const { include, exclude } = options || {};
9
+ walk.Object(anyJSON, (value, lodashPath) => {
10
+ if (!_.isUndefined(value)) {
11
+ pathes.push(lodashPath);
12
+ }
13
+ }, { include, exclude, checkCircural: true });
14
+ return pathes;
15
+ }
16
+ static cleaned(json, onCircs, options) {
17
+ const result = _.isArray(json) ? [] : {};
18
+ const classFN = CLASS.OBJECT(json).isClassObject && CLASS.getFromObject(json);
19
+ const { exclude, include, breadthWalk } = options || { exclude: [], include: [], breadthWalk: false };
20
+ const { circs } = walk.Object(json, (value, lodashPath, changeValueTo, options) => {
21
+ if (_.isObject(value) && options.isCircural) {
22
+ _.set(result, lodashPath, null);
23
+ }
24
+ else {
25
+ _.set(result, lodashPath, _.cloneDeep(value));
26
+ }
27
+ }, { include, exclude, breadthWalk, checkCircural: true });
28
+ if (_.isFunction(onCircs)) {
29
+ onCircs(circs);
30
+ }
31
+ return _.isFunction(classFN) ? _.merge(new classFN(), result) : result;
32
+ }
33
+ static stringify(anyJSON, replace, spaces, onCircs) {
34
+ const json = this.cleaned(anyJSON, onCircs);
35
+ return JSON.stringify(json, replace, spaces);
36
+ }
37
+ static parse(json, circs = []) {
38
+ let res = JSON.parse(json);
39
+ if (_.isArray(circs)) {
40
+ circs.forEach(({ circuralTargetPath, pathToObj }) => {
41
+ if (circuralTargetPath === '') {
42
+ _.set(res, pathToObj, res);
43
+ }
44
+ else {
45
+ let v = _.get(res, circuralTargetPath);
46
+ _.set(res, pathToObj, v);
47
+ }
48
+ });
49
+ }
50
+ return res;
51
+ }
52
+ }
53
+ ;
54
54
  ({}); // @--end-of-file-for-module=json10 lib/index.ts
55
55
 
56
- /**
57
- * Generated bundle index. Do not edit.
56
+ /**
57
+ * Generated bundle index. Do not edit.
58
58
  */
59
59
 
60
60
  export { JSON10 };
@@ -1,6 +1,6 @@
1
1
  // @ts-nocheck
2
- /**
3
- * Generated bundle index. Do not edit.
4
- */
5
- /// <amd-module name="json10" />
2
+ /**
3
+ * Generated bundle index. Do not edit.
4
+ */
5
+ /// <amd-module name="json10" />
6
6
  export * from './public-api';
@@ -1,16 +1,16 @@
1
1
  // @ts-nocheck
2
- import { Models } from 'lodash-walk-object/browser';
3
- export declare type Circ = Models.Circ;
4
- export declare class JSON10 {
5
- static structureArray(anyJSON: Object, options?: {
6
- include?: string[];
7
- exclude?: string[];
8
- }): any[];
9
- static cleaned(json: any, onCircs?: (circs: Circ[]) => any, options?: {
10
- exclude?: string[];
11
- include?: string[];
12
- breadthWalk?: boolean;
13
- }): any;
14
- static stringify(anyJSON: Object, replace?: any, spaces?: number, onCircs?: (circs: Circ[]) => any): string;
15
- static parse(json: string, circs?: Circ[]): any;
2
+ import { Models } from 'lodash-walk-object/browser';
3
+ export declare type Circ = Models.Circ;
4
+ export declare class JSON10 {
5
+ static structureArray(anyJSON: Object, options?: {
6
+ include?: string[];
7
+ exclude?: string[];
8
+ }): any[];
9
+ static cleaned(json: any, onCircs?: (circs: Circ[]) => any, options?: {
10
+ exclude?: string[];
11
+ include?: string[];
12
+ breadthWalk?: boolean;
13
+ }): any;
14
+ static stringify(anyJSON: Object, replace?: any, spaces?: number, onCircs?: (circs: Circ[]) => any): string;
15
+ static parse(json: string, circs?: Circ[]): any;
16
16
  }
package/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from './lib';
1
+ export * from './lib';
package/lib/index.d.ts CHANGED
@@ -1,15 +1,15 @@
1
- import { Models } from 'lodash-walk-object';
2
- export declare type Circ = Models.Circ;
3
- export declare class JSON10 {
4
- static structureArray(anyJSON: Object, options?: {
5
- include?: string[];
6
- exclude?: string[];
7
- }): any[];
8
- static cleaned(json: any, onCircs?: (circs: Circ[]) => any, options?: {
9
- exclude?: string[];
10
- include?: string[];
11
- breadthWalk?: boolean;
12
- }): any;
13
- static stringify(anyJSON: Object, replace?: any, spaces?: number, onCircs?: (circs: Circ[]) => any): string;
14
- static parse(json: string, circs?: Circ[]): any;
15
- }
1
+ import { Models } from 'lodash-walk-object';
2
+ export declare type Circ = Models.Circ;
3
+ export declare class JSON10 {
4
+ static structureArray(anyJSON: Object, options?: {
5
+ include?: string[];
6
+ exclude?: string[];
7
+ }): any[];
8
+ static cleaned(json: any, onCircs?: (circs: Circ[]) => any, options?: {
9
+ exclude?: string[];
10
+ include?: string[];
11
+ breadthWalk?: boolean;
12
+ }): any;
13
+ static stringify(anyJSON: Object, replace?: any, spaces?: number, onCircs?: (circs: Circ[]) => any): string;
14
+ static parse(json: string, circs?: Circ[]): any;
15
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "json10",
3
3
  "description": "Handle circural references, comments and many more inside JSON",
4
- "version": "13.1.36",
4
+ "version": "13.1.37",
5
5
  "scripts": {
6
6
  "test": "mocha --require ts-node/register src/**/*.spec.ts",
7
7
  "test:watch": "mocha --compilers ts-node/register src/**/*.spec.ts --watch"
@@ -21,10 +21,10 @@
21
21
  },
22
22
  "homepage": "https://github.com/darekf77/json10#readme",
23
23
  "dependencies": {
24
- "lodash-walk-object": "~13.1.36"
24
+ "lodash-walk-object": "~13.1.37"
25
25
  },
26
26
  "license": "MIT",
27
27
  "private": false,
28
- "lastBuildTagHash": "036c3ad04adb05b469d1aedff364c2aeeb9bbe91",
28
+ "lastBuildTagHash": "e7e442310caa98c8a8038f7fc13327ddfc692a9c",
29
29
  "devDependencies": {}
30
30
  }