json10 21.0.28 → 21.0.29
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/browser/fesm2022/json10-browser.mjs +22 -11
- package/browser/fesm2022/json10-browser.mjs.map +1 -1
- package/browser/package.json +1 -1
- package/browser/types/json10-browser.d.ts +5 -5
- package/browser-prod/fesm2022/json10-browser.mjs +23 -12
- package/browser-prod/fesm2022/json10-browser.mjs.map +1 -1
- package/browser-prod/package.json +1 -1
- package/browser-prod/types/json10-browser.d.ts +5 -5
- package/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib/build-info._auto-generated_.js +1 -1
- package/lib/index.d.ts +1 -15
- package/lib/index.js +15 -57
- package/lib/index.js.map +1 -1
- package/lib/json10.d.ts +16 -0
- package/lib/json10.js +71 -0
- package/lib/json10.js.map +1 -0
- package/lib/package.json +1 -1
- package/lib-prod/build-info._auto-generated_.d.ts +1 -1
- package/lib-prod/build-info._auto-generated_.js +1 -1
- package/lib-prod/index.d.ts +1 -15
- package/lib-prod/index.js +1 -55
- package/lib-prod/index.js.map +1 -1
- package/lib-prod/json10.d.ts +16 -0
- package/lib-prod/json10.js +67 -0
- package/lib-prod/json10.js.map +1 -0
- package/lib-prod/package.json +1 -1
- package/package.json +1 -1
- package/websql/fesm2022/json10-websql.mjs +22 -11
- package/websql/fesm2022/json10-websql.mjs.map +1 -1
- package/websql/package.json +1 -1
- package/websql/types/json10-websql.d.ts +5 -5
- package/websql-prod/fesm2022/json10-websql.mjs +23 -12
- package/websql-prod/fesm2022/json10-websql.mjs.map +1 -1
- package/websql-prod/package.json +1 -1
- package/websql-prod/types/json10-websql.d.ts +5 -5
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { _ } from 'tnp-core/browser';
|
|
2
2
|
import { walk } from 'lodash-walk-object/browser';
|
|
3
|
-
import { CLASS } from 'typescript-class-helpers/browser';
|
|
4
3
|
|
|
5
4
|
// import { Log } from 'ng2-logger'
|
|
6
5
|
// const log = Log.create('JSON10')
|
|
@@ -19,8 +18,11 @@ class JSON10 {
|
|
|
19
18
|
static cleaned(json, onCircs, options) {
|
|
20
19
|
// console.log('BETTER SRUGUB', json)
|
|
21
20
|
const result = _.isArray(json) ? [] : {};
|
|
22
|
-
const
|
|
23
|
-
|
|
21
|
+
const { exclude, include, breadthWalk } = options || {
|
|
22
|
+
exclude: [],
|
|
23
|
+
include: [],
|
|
24
|
+
breadthWalk: false,
|
|
25
|
+
};
|
|
24
26
|
const { circs } = walk.Object(json, (value, lodashPath, changeValueTo, options) => {
|
|
25
27
|
if (_.isObject(value) && options.isCircural) {
|
|
26
28
|
_.set(result, lodashPath, null);
|
|
@@ -32,25 +34,34 @@ class JSON10 {
|
|
|
32
34
|
if (_.isFunction(onCircs)) {
|
|
33
35
|
onCircs(circs);
|
|
34
36
|
}
|
|
35
|
-
return
|
|
37
|
+
return result;
|
|
36
38
|
}
|
|
37
39
|
static stringify(anyJSON, replace, spaces, onCircs) {
|
|
38
40
|
const json = this.cleaned(anyJSON, onCircs);
|
|
39
41
|
return JSON.stringify(json, replace, spaces);
|
|
40
42
|
}
|
|
41
|
-
static
|
|
42
|
-
|
|
43
|
-
if (_.isArray(circs)) {
|
|
43
|
+
static applyCircularMapping(json, circs = []) {
|
|
44
|
+
if (circs && _.isArray(circs)) {
|
|
44
45
|
circs.forEach(({ circuralTargetPath, pathToObj }) => {
|
|
45
|
-
if (circuralTargetPath
|
|
46
|
-
|
|
46
|
+
if (_.isString(circuralTargetPath)) {
|
|
47
|
+
if (circuralTargetPath === '') {
|
|
48
|
+
_.set(json, pathToObj, json);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
let v = _.get(json, circuralTargetPath);
|
|
52
|
+
_.set(json, pathToObj, v);
|
|
53
|
+
}
|
|
47
54
|
}
|
|
48
55
|
else {
|
|
49
|
-
|
|
50
|
-
_.set(res, pathToObj, v);
|
|
56
|
+
_.set(json, pathToObj, circuralTargetPath);
|
|
51
57
|
}
|
|
52
58
|
});
|
|
53
59
|
}
|
|
60
|
+
return json;
|
|
61
|
+
}
|
|
62
|
+
static parse(json, circs = []) {
|
|
63
|
+
let res = JSON.parse(json);
|
|
64
|
+
res = JSON10.applyCircularMapping(res, circs);
|
|
54
65
|
return res;
|
|
55
66
|
}
|
|
56
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json10-browser.mjs","sources":["../../../tmp-libs-for-dist/json10/projects/json10/src/lib/
|
|
1
|
+
{"version":3,"file":"json10-browser.mjs","sources":["../../../tmp-libs-for-dist/json10/projects/json10/src/lib/json10.ts","../../../tmp-libs-for-dist/json10/projects/json10/src/json10-browser.ts"],"sourcesContent":["import { _ } from 'tnp-core/browser';\nimport { walk, Models } from 'lodash-walk-object/browser';\nexport { Circ } from 'lodash-walk-object/browser';\nimport { Circ } from 'lodash-walk-object/browser';\nimport { CLASS } from 'typescript-class-helpers/browser';\n// import { Log } from 'ng2-logger'\n// const log = Log.create('JSON10')\n\n// let counter = 0\n\nexport class JSON10 {\n public static structureArray(\n anyJSON: Object,\n options?: { include?: string[]; exclude?: string[] },\n ) {\n let pathes = [];\n const { include, exclude } = options || ({} as any);\n walk.Object(\n anyJSON,\n (value, lodashPath) => {\n if (!_.isUndefined(value)) {\n pathes.push(lodashPath);\n }\n },\n { include, exclude, checkCircural: true },\n );\n return pathes;\n }\n\n public static cleaned(\n json,\n onCircs?: (circs: Circ[]) => any,\n options?: {\n exclude?: string[];\n include?: string[];\n breadthWalk?: boolean;\n },\n ) {\n // console.log('BETTER SRUGUB', json)\n const result = _.isArray(json) ? [] : {};\n\n const { exclude, include, breadthWalk } = options || {\n exclude: [],\n include: [],\n breadthWalk: false,\n };\n\n const { circs } = walk.Object(\n json,\n (value, lodashPath, changeValueTo, options) => {\n if (_.isObject(value) && options.isCircural) {\n _.set(result, lodashPath, null);\n } else {\n _.set(result, lodashPath, _.cloneDeep(value));\n }\n },\n { include, exclude, breadthWalk, checkCircural: true },\n );\n\n if (_.isFunction(onCircs)) {\n onCircs(circs);\n }\n\n return result;\n }\n\n public static stringify(\n anyJSON: Object,\n replace?: any,\n spaces?: number,\n onCircs?: (circs: Circ[]) => any,\n ): string {\n const json = this.cleaned(anyJSON, onCircs);\n return JSON.stringify(json, replace, spaces);\n }\n\n public static applyCircularMapping(json: object, circs: Circ[] = []): any {\n if (circs && _.isArray(circs)) {\n circs.forEach(({ circuralTargetPath, pathToObj }) => {\n if (_.isString(circuralTargetPath)) {\n if (circuralTargetPath === '') {\n _.set(json, pathToObj, json);\n } else {\n let v = _.get(json, circuralTargetPath);\n _.set(json, pathToObj, v);\n }\n } else {\n _.set(json, pathToObj, circuralTargetPath);\n }\n });\n }\n return json;\n }\n\n public static parse(json: string, circs: Circ[] = []): any {\n let res = JSON.parse(json);\n res = JSON10.applyCircularMapping(res, circs);\n return res;\n }\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAKA;AACA;AAEA;MAEa,MAAM,CAAA;AACV,IAAA,OAAO,cAAc,CAC1B,OAAe,EACf,OAAoD,EAAA;QAEpD,IAAI,MAAM,GAAG,EAAE;QACf,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO,IAAK,EAAU;QACnD,IAAI,CAAC,MAAM,CACT,OAAO,EACP,CAAC,KAAK,EAAE,UAAU,KAAI;YACpB,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE;AACzB,gBAAA,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;YACzB;QACF,CAAC,EACD,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,CAC1C;AACD,QAAA,OAAO,MAAM;IACf;AAEO,IAAA,OAAO,OAAO,CACnB,IAAI,EACJ,OAAgC,EAChC,OAIC,EAAA;;AAGD,QAAA,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,GAA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gBAAA,IAAI,CAAC,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE;AAClC,oBAAA,IAAI,kBAAkB,KAAK,EAAE,EAAE;wBAC7B,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC;oBAC9B;yBAAO;wBACL,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,kBAAkB,CAAC;wBACvC,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;oBAC3B;gBACF;qBAAO;oBACL,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,kBAAkB,CAAC;gBAC5C;AACF,YAAA,CAAC,CAAC;QACJ;AACA,QAAA,OAAO,IAAI;IACb;AAEO,IAAA,OAAO,KAAK,CAAC,IAAY,EAAE,QAAgB,EAAE,EAAA;QAClD,IAAI,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;QAC1B,GAAG,GAAG,MAAM,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,CAAC;AAC7C,QAAA,OAAO,GAAG;IACZ;AACD;;ACnGD;;AAEG;;;;"}
|
package/browser/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import {
|
|
2
|
+
import { Circ } from 'lodash-walk-object/browser';
|
|
3
|
+
export { Circ } from 'lodash-walk-object/browser';
|
|
3
4
|
|
|
4
|
-
type Circ = Models.Circ;
|
|
5
5
|
declare class JSON10 {
|
|
6
6
|
static structureArray(anyJSON: Object, options?: {
|
|
7
7
|
include?: string[];
|
|
@@ -11,10 +11,10 @@ declare class JSON10 {
|
|
|
11
11
|
exclude?: string[];
|
|
12
12
|
include?: string[];
|
|
13
13
|
breadthWalk?: boolean;
|
|
14
|
-
}):
|
|
14
|
+
}): {};
|
|
15
15
|
static stringify(anyJSON: Object, replace?: any, spaces?: number, onCircs?: (circs: Circ[]) => any): string;
|
|
16
|
+
static applyCircularMapping(json: object, circs?: Circ[]): any;
|
|
16
17
|
static parse(json: string, circs?: Circ[]): any;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
export { JSON10 };
|
|
20
|
-
export type { Circ };
|
|
20
|
+
export { JSON10 };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { ___NS__isUndefined, ___NS__isArray, ___NS__isObject, ___NS__set, ___NS__cloneDeep, ___NS__isFunction,
|
|
1
|
+
import { ___NS__isUndefined, ___NS__isArray, ___NS__isObject, ___NS__set, ___NS__cloneDeep, ___NS__isFunction, ___NS__isString, ___NS__get } from 'tnp-core/browser-prod';
|
|
2
2
|
import { walk } from 'lodash-walk-object/browser-prod';
|
|
3
|
-
import { CLASS } from 'typescript-class-helpers/browser-prod';
|
|
4
3
|
|
|
5
4
|
// import { Log } from 'ng2-logger'
|
|
6
5
|
// const log = Log.create('JSON10')
|
|
@@ -19,8 +18,11 @@ class JSON10 {
|
|
|
19
18
|
static cleaned(json, onCircs, options) {
|
|
20
19
|
// console.log('BETTER SRUGUB', json)
|
|
21
20
|
const result = ___NS__isArray(json) ? [] : {};
|
|
22
|
-
const
|
|
23
|
-
|
|
21
|
+
const { exclude, include, breadthWalk } = options || {
|
|
22
|
+
exclude: [],
|
|
23
|
+
include: [],
|
|
24
|
+
breadthWalk: false,
|
|
25
|
+
};
|
|
24
26
|
const { circs } = walk.Object(json, (value, lodashPath, changeValueTo, options) => {
|
|
25
27
|
if (___NS__isObject(value) && options.isCircural) {
|
|
26
28
|
___NS__set(result, lodashPath, null);
|
|
@@ -32,25 +34,34 @@ class JSON10 {
|
|
|
32
34
|
if (___NS__isFunction(onCircs)) {
|
|
33
35
|
onCircs(circs);
|
|
34
36
|
}
|
|
35
|
-
return
|
|
37
|
+
return result;
|
|
36
38
|
}
|
|
37
39
|
static stringify(anyJSON, replace, spaces, onCircs) {
|
|
38
40
|
const json = this.cleaned(anyJSON, onCircs);
|
|
39
41
|
return JSON.stringify(json, replace, spaces);
|
|
40
42
|
}
|
|
41
|
-
static
|
|
42
|
-
|
|
43
|
-
if (___NS__isArray(circs)) {
|
|
43
|
+
static applyCircularMapping(json, circs = []) {
|
|
44
|
+
if (circs && ___NS__isArray(circs)) {
|
|
44
45
|
circs.forEach(({ circuralTargetPath, pathToObj }) => {
|
|
45
|
-
if (circuralTargetPath
|
|
46
|
-
|
|
46
|
+
if (___NS__isString(circuralTargetPath)) {
|
|
47
|
+
if (circuralTargetPath === '') {
|
|
48
|
+
___NS__set(json, pathToObj, json);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
let v = ___NS__get(json, circuralTargetPath);
|
|
52
|
+
___NS__set(json, pathToObj, v);
|
|
53
|
+
}
|
|
47
54
|
}
|
|
48
55
|
else {
|
|
49
|
-
|
|
50
|
-
___NS__set(res, pathToObj, v);
|
|
56
|
+
___NS__set(json, pathToObj, circuralTargetPath);
|
|
51
57
|
}
|
|
52
58
|
});
|
|
53
59
|
}
|
|
60
|
+
return json;
|
|
61
|
+
}
|
|
62
|
+
static parse(json, circs = []) {
|
|
63
|
+
let res = JSON.parse(json);
|
|
64
|
+
res = JSON10.applyCircularMapping(res, circs);
|
|
54
65
|
return res;
|
|
55
66
|
}
|
|
56
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json10-browser.mjs","sources":["../../../tmp-libs-for-dist-prod/json10/projects/json10/src/lib/index.ts","../../../tmp-libs-for-dist-prod/json10/projects/json10/src/json10-browser.ts"],"sourcesContent":["import { ___NS__add, ___NS__after, ___NS__ary, ___NS__assign, ___NS__assignIn, ___NS__assignInWith, ___NS__assignWith, ___NS__at, ___NS__attempt, ___NS__before, ___NS__bind, ___NS__bindAll, ___NS__bindKey, ___NS__camelCase, ___NS__capitalize, ___NS__castArray, ___NS__ceil, ___NS__chain, ___NS__chunk, ___NS__clamp, ___NS__clone, ___NS__cloneDeep, ___NS__cloneDeepWith, ___NS__cloneWith, ___NS__compact, ___NS__concat, ___NS__cond, ___NS__conforms, ___NS__conformsTo, ___NS__constant, ___NS__countBy, ___NS__create, ___NS__curry, ___NS__curryRight, ___NS__debounce, ___NS__deburr, ___NS__defaults, ___NS__defaultsDeep, ___NS__defaultTo, ___NS__defer, ___NS__delay, ___NS__difference, ___NS__differenceBy, ___NS__differenceWith, ___NS__divide, ___NS__drop, ___NS__dropRight, ___NS__dropRightWhile, ___NS__dropWhile, ___NS__each, ___NS__eachRight, ___NS__endsWith, ___NS__entries, ___NS__entriesIn, ___NS__eq, ___NS__escape, ___NS__escapeRegExp, ___NS__every, ___NS__extend, ___NS__extendWith, ___NS__fill, ___NS__filter, ___NS__find, ___NS__findIndex, ___NS__findKey, ___NS__findLast, ___NS__findLastIndex, ___NS__findLastKey, ___NS__first, ___NS__flatMap, ___NS__flatMapDeep, ___NS__flatMapDepth, ___NS__flatten, ___NS__flattenDeep, ___NS__flattenDepth, ___NS__flip, ___NS__floor, ___NS__flow, ___NS__flowRight, ___NS__forEach, ___NS__forEachRight, ___NS__forIn, ___NS__forInRight, ___NS__forOwn, ___NS__forOwnRight, ___NS__fromPairs, ___NS__functions, ___NS__functionsIn, ___NS__get, ___NS__groupBy, ___NS__gt, ___NS__gte, ___NS__has, ___NS__hasIn, ___NS__head, ___NS__identity, ___NS__includes, ___NS__indexOf, ___NS__initial, ___NS__inRange, ___NS__intersection, ___NS__intersectionBy, ___NS__intersectionWith, ___NS__invert, ___NS__invertBy, ___NS__invoke, ___NS__invokeMap, ___NS__isArguments, ___NS__isArray, ___NS__isArrayBuffer, ___NS__isArrayLike, ___NS__isArrayLikeObject, ___NS__isBoolean, ___NS__isBuffer, ___NS__isDate, ___NS__isElement, ___NS__isEmpty, ___NS__isEqual, ___NS__isEqualWith, ___NS__isError, ___NS__isFinite, ___NS__isFunction, ___NS__isInteger, ___NS__isLength, ___NS__isMap, ___NS__isMatch, ___NS__isMatchWith, ___NS__isNaN, ___NS__isNative, ___NS__isNil, ___NS__isNull, ___NS__isNumber, ___NS__isObject, ___NS__isObjectLike, ___NS__isPlainObject, ___NS__isRegExp, ___NS__isSafeInteger, ___NS__isSet, ___NS__isString, ___NS__isSymbol, ___NS__isTypedArray, ___NS__isUndefined, ___NS__isWeakMap, ___NS__isWeakSet, ___NS__iteratee, ___NS__join, ___NS__kebabCase, ___NS__keyBy, ___NS__keys, ___NS__keysIn, ___NS__last, ___NS__lastIndexOf, ___NS__lowerCase, ___NS__lowerFirst, ___NS__lt, ___NS__lte, ___NS__map, ___NS__mapKeys, ___NS__mapValues, ___NS__matches, ___NS__matchesProperty, ___NS__max, ___NS__maxBy, ___NS__mean, ___NS__meanBy, ___NS__memoize, ___NS__merge, ___NS__mergeWith, ___NS__method, ___NS__methodOf, ___NS__min, ___NS__minBy, ___NS__mixin, ___NS__multiply, ___NS__negate, ___NS__noop, ___NS__now, ___NS__nth, ___NS__nthArg, ___NS__omit, ___NS__omitBy, ___NS__once, ___NS__orderBy, ___NS__over, ___NS__overArgs, ___NS__overEvery, ___NS__overSome, ___NS__pad, ___NS__padEnd, ___NS__padStart, ___NS__parseInt, ___NS__partial, ___NS__partialRight, ___NS__partition, ___NS__pick, ___NS__pickBy, ___NS__property, ___NS__propertyOf, ___NS__pull, ___NS__pullAll, ___NS__pullAllBy, ___NS__pullAllWith, ___NS__pullAt, ___NS__random, ___NS__range, ___NS__rangeRight, ___NS__rearg, ___NS__reduce, ___NS__reduceRight, ___NS__reject, ___NS__remove, ___NS__repeat, ___NS__replace, ___NS__rest, ___NS__result, ___NS__reverse, ___NS__round, ___NS__sample, ___NS__sampleSize, ___NS__set, ___NS__setWith, ___NS__shuffle, ___NS__size, ___NS__slice, ___NS__snakeCase, ___NS__some, ___NS__sortBy, ___NS__sortedIndex, ___NS__sortedIndexBy, ___NS__sortedIndexOf, ___NS__sortedLastIndex, ___NS__sortedLastIndexBy, ___NS__sortedLastIndexOf, ___NS__sortedUniq, ___NS__sortedUniqBy, ___NS__split, ___NS__spread, ___NS__startCase, ___NS__startsWith, ___NS__stubArray, ___NS__stubFalse, ___NS__stubObject, ___NS__stubString, ___NS__stubTrue, ___NS__subtract, ___NS__sum, ___NS__sumBy, ___NS__tail, ___NS__take, ___NS__takeRight, ___NS__takeRightWhile, ___NS__takeWhile, ___NS__tap, ___NS__template, ___NS__templateSettings, ___NS__throttle, ___NS__thru, ___NS__times, ___NS__toArray, ___NS__toFinite, ___NS__toInteger, ___NS__toLength, ___NS__toLower, ___NS__toNumber, ___NS__toPairs, ___NS__toPairsIn, ___NS__toPath, ___NS__toPlainObject, ___NS__toSafeInteger, ___NS__toString, ___NS__toUpper, ___NS__transform, ___NS__trim, ___NS__trimEnd, ___NS__trimStart, ___NS__truncate, ___NS__unary, ___NS__unescape, ___NS__union, ___NS__unionBy, ___NS__unionWith, ___NS__uniq, ___NS__uniqBy, ___NS__uniqueId, ___NS__uniqWith, ___NS__unset, ___NS__unzip, ___NS__unzipWith, ___NS__update, ___NS__updateWith, ___NS__upperCase, ___NS__upperFirst, ___NS__values, ___NS__valuesIn, ___NS__without, ___NS__words, ___NS__wrap, ___NS__xor, ___NS__xorBy, ___NS__xorWith, ___NS__zip, ___NS__zipObject, ___NS__zipObjectDeep, ___NS__zipWith } from 'tnp-core/browser-prod';\nimport { walk, Models__NS__AdditionalIteratorOptions, Models__NS__Circ, Models__NS__InDBType, Models__NS__InternalValues, Models__NS__StartIteratorOptions, Models__NS__Ver } from 'lodash-walk-object/browser-prod';\nexport type Circ = Models__NS__Circ;\nimport { CLASS } from 'typescript-class-helpers/browser-prod';\n// import { Log } from 'ng2-logger'\n// const log = Log.create('JSON10')\n\n// let counter = 0\n\nexport class JSON10 {\n\n public static structureArray(anyJSON: Object, options?: { include?: string[]; exclude?: string[] }) {\n let pathes = []\n const { include, exclude } = options || {} as any;\n walk.Object(anyJSON, (value, lodashPath) => {\n\n if (!___NS__isUndefined(value)) {\n pathes.push(lodashPath)\n }\n\n }, { include, exclude, checkCircural: true })\n return pathes;\n }\n\n\n public static cleaned(json, onCircs?: (circs: Circ[]) => any, options?:\n {\n exclude?: string[];\n include?: string[];\n breadthWalk?: boolean;\n }) {\n // console.log('BETTER SRUGUB', json)\n const result = ___NS__isArray(json) ? [] : {}\n const classFN = CLASS.OBJECT(json).isClassObject && CLASS.getFromObject(json);\n\n const { exclude, include, breadthWalk } = options || { exclude: [], include: [], breadthWalk: false };\n\n const { circs } = walk.Object(json, (value, lodashPath, changeValueTo, options) => {\n\n if (___NS__isObject(value) && options.isCircural) {\n ___NS__set(result, lodashPath, null)\n } else {\n ___NS__set(result, lodashPath, ___NS__cloneDeep(value))\n }\n\n }, { include, exclude, breadthWalk, checkCircural: true });\n\n if (___NS__isFunction(onCircs)) {\n onCircs(circs)\n }\n\n return ___NS__isFunction(classFN) ? ___NS__merge(new (classFN as any)(), result) : result;\n }\n\n public static stringify(anyJSON: Object, replace?: any, spaces?: number, onCircs?: (circs: Circ[]) => any) {\n const json = this.cleaned(anyJSON, onCircs);\n return JSON.stringify(json, replace, spaces);\n }\n\n public static parse(json: string, circs: Circ[] = []) {\n let res = JSON.parse(json);\n if (___NS__isArray(circs)) {\n circs.forEach(({ circuralTargetPath, pathToObj }) => {\n\n if (circuralTargetPath === '') {\n ___NS__set(res, pathToObj, res)\n } else {\n let v = ___NS__get(res, circuralTargetPath);\n ___NS__set(res, pathToObj, v)\n }\n\n })\n }\n return res;\n }\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAIA;AACA;AAEA;MAEa,MAAM,CAAA;AAEV,IAAA,OAAO,cAAc,CAAC,OAAe,EAAE,OAAoD,EAAA;QAChG,IAAI,MAAM,GAAG,EAAE;QACf,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO,IAAI,EAAS;QACjD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,KAAI;AAEzC,YAAA,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE;AAC9B,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3F;IAEO,OAAO,SAAS,CAAC,OAAe,EAAE,OAAa,EAAE,MAAe,EAAE,OAAgC,EAAA;QACvG,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC;QAC3C,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC;IAC9C;AAEO,IAAA,OAAO,KAAK,CAAC,IAAY,EAAE,QAAgB,EAAE,EAAA;QAClD,IAAI,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;AAC1B,QAAA,IAAI,cAAc,CAAC,KAAK,CAAC,EAAE;YACzB,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,kBAAkB,EAAE,SAAS,EAAE,KAAI;AAElD,gBAAA,IAAI,kBAAkB,KAAK,EAAE,EAAE;AAC7B,oBAAA,UAAU,CAAC,GAAG,EAAE,SAAS,EAAE,GAAG,CAAC;gBACjC;qBAAO;oBACL,IAAI,CAAC,GAAG,UAAU,CAAC,GAAG,EAAE,kBAAkB,CAAC;AAC3C,oBAAA,UAAU,CAAC,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;gBAC/B;AAEF,YAAA,CAAC,CAAC;QACJ;AACA,QAAA,OAAO,GAAG;IACZ;AACD;;AC3ED;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"json10-browser.mjs","sources":["../../../tmp-libs-for-dist-prod/json10/projects/json10/src/lib/json10.ts","../../../tmp-libs-for-dist-prod/json10/projects/json10/src/json10-browser.ts"],"sourcesContent":["import { ___NS__add, ___NS__after, ___NS__ary, ___NS__assign, ___NS__assignIn, ___NS__assignInWith, ___NS__assignWith, ___NS__at, ___NS__attempt, ___NS__before, ___NS__bind, ___NS__bindAll, ___NS__bindKey, ___NS__camelCase, ___NS__capitalize, ___NS__castArray, ___NS__ceil, ___NS__chain, ___NS__chunk, ___NS__clamp, ___NS__clone, ___NS__cloneDeep, ___NS__cloneDeepWith, ___NS__cloneWith, ___NS__compact, ___NS__concat, ___NS__cond, ___NS__conforms, ___NS__conformsTo, ___NS__constant, ___NS__countBy, ___NS__create, ___NS__curry, ___NS__curryRight, ___NS__debounce, ___NS__deburr, ___NS__defaults, ___NS__defaultsDeep, ___NS__defaultTo, ___NS__defer, ___NS__delay, ___NS__difference, ___NS__differenceBy, ___NS__differenceWith, ___NS__divide, ___NS__drop, ___NS__dropRight, ___NS__dropRightWhile, ___NS__dropWhile, ___NS__each, ___NS__eachRight, ___NS__endsWith, ___NS__entries, ___NS__entriesIn, ___NS__eq, ___NS__escape, ___NS__escapeRegExp, ___NS__every, ___NS__extend, ___NS__extendWith, ___NS__fill, ___NS__filter, ___NS__find, ___NS__findIndex, ___NS__findKey, ___NS__findLast, ___NS__findLastIndex, ___NS__findLastKey, ___NS__first, ___NS__flatMap, ___NS__flatMapDeep, ___NS__flatMapDepth, ___NS__flatten, ___NS__flattenDeep, ___NS__flattenDepth, ___NS__flip, ___NS__floor, ___NS__flow, ___NS__flowRight, ___NS__forEach, ___NS__forEachRight, ___NS__forIn, ___NS__forInRight, ___NS__forOwn, ___NS__forOwnRight, ___NS__fromPairs, ___NS__functions, ___NS__functionsIn, ___NS__get, ___NS__groupBy, ___NS__gt, ___NS__gte, ___NS__has, ___NS__hasIn, ___NS__head, ___NS__identity, ___NS__includes, ___NS__indexOf, ___NS__initial, ___NS__inRange, ___NS__intersection, ___NS__intersectionBy, ___NS__intersectionWith, ___NS__invert, ___NS__invertBy, ___NS__invoke, ___NS__invokeMap, ___NS__isArguments, ___NS__isArray, ___NS__isArrayBuffer, ___NS__isArrayLike, ___NS__isArrayLikeObject, ___NS__isBoolean, ___NS__isBuffer, ___NS__isDate, ___NS__isElement, ___NS__isEmpty, ___NS__isEqual, ___NS__isEqualWith, ___NS__isError, ___NS__isFinite, ___NS__isFunction, ___NS__isInteger, ___NS__isLength, ___NS__isMap, ___NS__isMatch, ___NS__isMatchWith, ___NS__isNaN, ___NS__isNative, ___NS__isNil, ___NS__isNull, ___NS__isNumber, ___NS__isObject, ___NS__isObjectLike, ___NS__isPlainObject, ___NS__isRegExp, ___NS__isSafeInteger, ___NS__isSet, ___NS__isString, ___NS__isSymbol, ___NS__isTypedArray, ___NS__isUndefined, ___NS__isWeakMap, ___NS__isWeakSet, ___NS__iteratee, ___NS__join, ___NS__kebabCase, ___NS__keyBy, ___NS__keys, ___NS__keysIn, ___NS__last, ___NS__lastIndexOf, ___NS__lowerCase, ___NS__lowerFirst, ___NS__lt, ___NS__lte, ___NS__map, ___NS__mapKeys, ___NS__mapValues, ___NS__matches, ___NS__matchesProperty, ___NS__max, ___NS__maxBy, ___NS__mean, ___NS__meanBy, ___NS__memoize, ___NS__merge, ___NS__mergeWith, ___NS__method, ___NS__methodOf, ___NS__min, ___NS__minBy, ___NS__mixin, ___NS__multiply, ___NS__negate, ___NS__noop, ___NS__now, ___NS__nth, ___NS__nthArg, ___NS__omit, ___NS__omitBy, ___NS__once, ___NS__orderBy, ___NS__over, ___NS__overArgs, ___NS__overEvery, ___NS__overSome, ___NS__pad, ___NS__padEnd, ___NS__padStart, ___NS__parseInt, ___NS__partial, ___NS__partialRight, ___NS__partition, ___NS__pick, ___NS__pickBy, ___NS__property, ___NS__propertyOf, ___NS__pull, ___NS__pullAll, ___NS__pullAllBy, ___NS__pullAllWith, ___NS__pullAt, ___NS__random, ___NS__range, ___NS__rangeRight, ___NS__rearg, ___NS__reduce, ___NS__reduceRight, ___NS__reject, ___NS__remove, ___NS__repeat, ___NS__replace, ___NS__rest, ___NS__result, ___NS__reverse, ___NS__round, ___NS__sample, ___NS__sampleSize, ___NS__set, ___NS__setWith, ___NS__shuffle, ___NS__size, ___NS__slice, ___NS__snakeCase, ___NS__some, ___NS__sortBy, ___NS__sortedIndex, ___NS__sortedIndexBy, ___NS__sortedIndexOf, ___NS__sortedLastIndex, ___NS__sortedLastIndexBy, ___NS__sortedLastIndexOf, ___NS__sortedUniq, ___NS__sortedUniqBy, ___NS__split, ___NS__spread, ___NS__startCase, ___NS__startsWith, ___NS__stubArray, ___NS__stubFalse, ___NS__stubObject, ___NS__stubString, ___NS__stubTrue, ___NS__subtract, ___NS__sum, ___NS__sumBy, ___NS__tail, ___NS__take, ___NS__takeRight, ___NS__takeRightWhile, ___NS__takeWhile, ___NS__tap, ___NS__template, ___NS__templateSettings, ___NS__throttle, ___NS__thru, ___NS__times, ___NS__toArray, ___NS__toFinite, ___NS__toInteger, ___NS__toLength, ___NS__toLower, ___NS__toNumber, ___NS__toPairs, ___NS__toPairsIn, ___NS__toPath, ___NS__toPlainObject, ___NS__toSafeInteger, ___NS__toString, ___NS__toUpper, ___NS__transform, ___NS__trim, ___NS__trimEnd, ___NS__trimStart, ___NS__truncate, ___NS__unary, ___NS__unescape, ___NS__union, ___NS__unionBy, ___NS__unionWith, ___NS__uniq, ___NS__uniqBy, ___NS__uniqueId, ___NS__uniqWith, ___NS__unset, ___NS__unzip, ___NS__unzipWith, ___NS__update, ___NS__updateWith, ___NS__upperCase, ___NS__upperFirst, ___NS__values, ___NS__valuesIn, ___NS__without, ___NS__words, ___NS__wrap, ___NS__xor, ___NS__xorBy, ___NS__xorWith, ___NS__zip, ___NS__zipObject, ___NS__zipObjectDeep, ___NS__zipWith } from 'tnp-core/browser-prod';\nimport { walk, Models__NS__AdditionalIteratorOptions, Models__NS__InDBType, Models__NS__InternalValues, Models__NS__StartIteratorOptions, Models__NS__Ver } from 'lodash-walk-object/browser-prod';\nexport { Circ } from 'lodash-walk-object/browser-prod';\nimport { Circ } from 'lodash-walk-object/browser-prod';\nimport { CLASS__NS__getBy, CLASS__NS__getClassNameFromObjInstanceOrClassFn, CLASS__NS__getMethodsNames, CLASS__NS__getName, CLASS__NS__getNameFromObject, CLASS__NS__NAME, CLASS__NS__setClassName, CLASS__NS__setName } from 'typescript-class-helpers/browser-prod';\n// import { Log } from 'ng2-logger'\n// const log = Log.create('JSON10')\n\n// let counter = 0\n\nexport class JSON10 {\n public static structureArray(\n anyJSON: Object,\n options?: { include?: string[]; exclude?: string[] },\n ) {\n let pathes = [];\n const { include, exclude } = options || ({} as any);\n walk.Object(\n anyJSON,\n (value, lodashPath) => {\n if (!___NS__isUndefined(value)) {\n pathes.push(lodashPath);\n }\n },\n { include, exclude, checkCircural: true },\n );\n return pathes;\n }\n\n public static cleaned(\n json,\n onCircs?: (circs: Circ[]) => any,\n options?: {\n exclude?: string[];\n include?: string[];\n breadthWalk?: boolean;\n },\n ) {\n // console.log('BETTER SRUGUB', json)\n const result = ___NS__isArray(json) ? [] : {};\n\n const { exclude, include, breadthWalk } = options || {\n exclude: [],\n include: [],\n breadthWalk: false,\n };\n\n const { circs } = walk.Object(\n json,\n (value, lodashPath, changeValueTo, options) => {\n if (___NS__isObject(value) && options.isCircural) {\n ___NS__set(result, lodashPath, null);\n } else {\n ___NS__set(result, lodashPath, ___NS__cloneDeep(value));\n }\n },\n { include, exclude, breadthWalk, checkCircural: true },\n );\n\n if (___NS__isFunction(onCircs)) {\n onCircs(circs);\n }\n\n return result;\n }\n\n public static stringify(\n anyJSON: Object,\n replace?: any,\n spaces?: number,\n onCircs?: (circs: Circ[]) => any,\n ): string {\n const json = this.cleaned(anyJSON, onCircs);\n return JSON.stringify(json, replace, spaces);\n }\n\n public static applyCircularMapping(json: object, circs: Circ[] = []): any {\n if (circs && ___NS__isArray(circs)) {\n circs.forEach(({ circuralTargetPath, pathToObj }) => {\n if (___NS__isString(circuralTargetPath)) {\n if (circuralTargetPath === '') {\n ___NS__set(json, pathToObj, json);\n } else {\n let v = ___NS__get(json, circuralTargetPath);\n ___NS__set(json, pathToObj, v);\n }\n } else {\n ___NS__set(json, pathToObj, circuralTargetPath);\n }\n });\n }\n return json;\n }\n\n public static parse(json: string, circs: Circ[] = []): any {\n let res = JSON.parse(json);\n res = JSON10.applyCircularMapping(res, circs);\n return res;\n }\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAKA;AACA;AAEA;MAEa,MAAM,CAAA;AACV,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1
|
// @ts-nocheck
|
|
2
|
-
import {
|
|
2
|
+
import { Circ } from 'lodash-walk-object/browser-prod';
|
|
3
|
+
export { Circ } from 'lodash-walk-object/browser-prod';
|
|
3
4
|
|
|
4
|
-
type Circ = Models__NS__Circ;
|
|
5
5
|
declare class JSON10 {
|
|
6
6
|
static structureArray(anyJSON: Object, options?: {
|
|
7
7
|
include?: string[];
|
|
@@ -11,10 +11,10 @@ declare class JSON10 {
|
|
|
11
11
|
exclude?: string[];
|
|
12
12
|
include?: string[];
|
|
13
13
|
breadthWalk?: boolean;
|
|
14
|
-
}):
|
|
14
|
+
}): {};
|
|
15
15
|
static stringify(anyJSON: Object, replace?: any, spaces?: number, onCircs?: (circs: Circ[]) => any): string;
|
|
16
|
+
static applyCircularMapping(json: object, circs?: Circ[]): any;
|
|
16
17
|
static parse(json: string, circs?: Circ[]): any;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
export { JSON10 };
|
|
20
|
-
export type { Circ };
|
|
20
|
+
export { JSON10 };
|
|
@@ -25,6 +25,6 @@ exports.CURRENT_PACKAGE_TAON_VERSION = 'v21';
|
|
|
25
25
|
/**
|
|
26
26
|
* Autogenerated by current cli tool. Use *tnp release* to bump version.
|
|
27
27
|
*/
|
|
28
|
-
exports.CURRENT_PACKAGE_VERSION = '21.0.
|
|
28
|
+
exports.CURRENT_PACKAGE_VERSION = '21.0.29';
|
|
29
29
|
// THIS FILE IS GENERATED - DO NOT MODIFY
|
|
30
30
|
//# sourceMappingURL=build-info._auto-generated_.js.map
|
package/lib/index.d.ts
CHANGED
|
@@ -1,15 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export 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
|
+
export * from './json10';
|
package/lib/index.js
CHANGED
|
@@ -1,60 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// import { Log } from 'ng2-logger'
|
|
8
|
-
// const log = Log.create('JSON10')
|
|
9
|
-
// let counter = 0
|
|
10
|
-
class JSON10 {
|
|
11
|
-
static structureArray(anyJSON, options) {
|
|
12
|
-
let pathes = [];
|
|
13
|
-
const { include, exclude } = options || {};
|
|
14
|
-
lib_2.walk.Object(anyJSON, (value, lodashPath) => {
|
|
15
|
-
if (!lib_1._.isUndefined(value)) {
|
|
16
|
-
pathes.push(lodashPath);
|
|
17
|
-
}
|
|
18
|
-
}, { include, exclude, checkCircural: true });
|
|
19
|
-
return pathes;
|
|
20
|
-
}
|
|
21
|
-
static cleaned(json, onCircs, options) {
|
|
22
|
-
// console.log('BETTER SRUGUB', json)
|
|
23
|
-
const result = lib_1._.isArray(json) ? [] : {};
|
|
24
|
-
const classFN = lib_3.CLASS.OBJECT(json).isClassObject && lib_3.CLASS.getFromObject(json);
|
|
25
|
-
const { exclude, include, breadthWalk } = options || { exclude: [], include: [], breadthWalk: false };
|
|
26
|
-
const { circs } = lib_2.walk.Object(json, (value, lodashPath, changeValueTo, options) => {
|
|
27
|
-
if (lib_1._.isObject(value) && options.isCircural) {
|
|
28
|
-
lib_1._.set(result, lodashPath, null);
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
lib_1._.set(result, lodashPath, lib_1._.cloneDeep(value));
|
|
32
|
-
}
|
|
33
|
-
}, { include, exclude, breadthWalk, checkCircural: true });
|
|
34
|
-
if (lib_1._.isFunction(onCircs)) {
|
|
35
|
-
onCircs(circs);
|
|
36
|
-
}
|
|
37
|
-
return lib_1._.isFunction(classFN) ? lib_1._.merge(new classFN(), result) : result;
|
|
38
|
-
}
|
|
39
|
-
static stringify(anyJSON, replace, spaces, onCircs) {
|
|
40
|
-
const json = this.cleaned(anyJSON, onCircs);
|
|
41
|
-
return JSON.stringify(json, replace, spaces);
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
42
7
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
return res;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
exports.JSON10 = JSON10;
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./json10"), exports);
|
|
60
18
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":[""],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":[""],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB"}
|
package/lib/json10.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { Circ } from 'lodash-walk-object';
|
|
2
|
+
import { Circ } from 'lodash-walk-object';
|
|
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
|
+
}): {};
|
|
13
|
+
static stringify(anyJSON: Object, replace?: any, spaces?: number, onCircs?: (circs: Circ[]) => any): string;
|
|
14
|
+
static applyCircularMapping(json: object, circs?: Circ[]): any;
|
|
15
|
+
static parse(json: string, circs?: Circ[]): any;
|
|
16
|
+
}
|
package/lib/json10.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JSON10 = void 0;
|
|
4
|
+
const lib_1 = require("tnp-core/lib");
|
|
5
|
+
const lib_2 = require("lodash-walk-object/lib");
|
|
6
|
+
// import { Log } from 'ng2-logger'
|
|
7
|
+
// const log = Log.create('JSON10')
|
|
8
|
+
// let counter = 0
|
|
9
|
+
class JSON10 {
|
|
10
|
+
static structureArray(anyJSON, options) {
|
|
11
|
+
let pathes = [];
|
|
12
|
+
const { include, exclude } = options || {};
|
|
13
|
+
lib_2.walk.Object(anyJSON, (value, lodashPath) => {
|
|
14
|
+
if (!lib_1._.isUndefined(value)) {
|
|
15
|
+
pathes.push(lodashPath);
|
|
16
|
+
}
|
|
17
|
+
}, { include, exclude, checkCircural: true });
|
|
18
|
+
return pathes;
|
|
19
|
+
}
|
|
20
|
+
static cleaned(json, onCircs, options) {
|
|
21
|
+
// console.log('BETTER SRUGUB', json)
|
|
22
|
+
const result = lib_1._.isArray(json) ? [] : {};
|
|
23
|
+
const { exclude, include, breadthWalk } = options || {
|
|
24
|
+
exclude: [],
|
|
25
|
+
include: [],
|
|
26
|
+
breadthWalk: false,
|
|
27
|
+
};
|
|
28
|
+
const { circs } = lib_2.walk.Object(json, (value, lodashPath, changeValueTo, options) => {
|
|
29
|
+
if (lib_1._.isObject(value) && options.isCircural) {
|
|
30
|
+
lib_1._.set(result, lodashPath, null);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
lib_1._.set(result, lodashPath, lib_1._.cloneDeep(value));
|
|
34
|
+
}
|
|
35
|
+
}, { include, exclude, breadthWalk, checkCircural: true });
|
|
36
|
+
if (lib_1._.isFunction(onCircs)) {
|
|
37
|
+
onCircs(circs);
|
|
38
|
+
}
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
static stringify(anyJSON, replace, spaces, onCircs) {
|
|
42
|
+
const json = this.cleaned(anyJSON, onCircs);
|
|
43
|
+
return JSON.stringify(json, replace, spaces);
|
|
44
|
+
}
|
|
45
|
+
static applyCircularMapping(json, circs = []) {
|
|
46
|
+
if (circs && lib_1._.isArray(circs)) {
|
|
47
|
+
circs.forEach(({ circuralTargetPath, pathToObj }) => {
|
|
48
|
+
if (lib_1._.isString(circuralTargetPath)) {
|
|
49
|
+
if (circuralTargetPath === '') {
|
|
50
|
+
lib_1._.set(json, pathToObj, json);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
let v = lib_1._.get(json, circuralTargetPath);
|
|
54
|
+
lib_1._.set(json, pathToObj, v);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
lib_1._.set(json, pathToObj, circuralTargetPath);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return json;
|
|
63
|
+
}
|
|
64
|
+
static parse(json, circs = []) {
|
|
65
|
+
let res = JSON.parse(json);
|
|
66
|
+
res = JSON10.applyCircularMapping(res, circs);
|
|
67
|
+
return res;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.JSON10 = JSON10;
|
|
71
|
+
//# sourceMappingURL=json10.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json10.js","sourceRoot":"","sources":[""],"names":[],"mappings":";;;AAAA,sCAAiC;AACjC,gDAAsD;AAItD,mCAAmC;AACnC,mCAAmC;AAEnC,kBAAkB;AAElB,MAAa,MAAM;IACV,MAAM,CAAC,cAAc,CAC1B,OAAe,EACf,OAAoD;QAEpD,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO,IAAK,EAAU,CAAC;QACpD,UAAI,CAAC,MAAM,CACT,OAAO,EACP,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE;YACpB,IAAI,CAAC,OAAC,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC1B,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC,EACD,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,CAC1C,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;IAEM,MAAM,CAAC,OAAO,CACnB,IAAI,EACJ,OAAgC,EAChC,OAIC;QAED,qCAAqC;QACrC,MAAM,MAAM,GAAG,OAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAEzC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,OAAO,IAAI;YACnD,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;YACX,WAAW,EAAE,KAAK;SACnB,CAAC;QAEF,MAAM,EAAE,KAAK,EA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AAG,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;oBAC/B,CAAC;yBAAM,CAAC;wBACN,IAAI,CAAC,GAAG,OAAC,CAAC,GAAG,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;wBACxC,OAAC,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;oBAC5B,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,OAAC,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,kBAAkB,CAAC,CAAC;gBAC7C,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,IAAY,EAAE,QAAgB,EAAE;QAClD,IAAI,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3B,GAAG,GAAG,MAAM,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC9C,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAzFD,wBAyFC"}
|
package/lib/package.json
CHANGED
|
@@ -22,6 +22,6 @@ export const CURRENT_PACKAGE_TAON_VERSION = 'v21';
|
|
|
22
22
|
/**
|
|
23
23
|
* Autogenerated by current cli tool. Use *tnp release* to bump version.
|
|
24
24
|
*/
|
|
25
|
-
export const CURRENT_PACKAGE_VERSION = '21.0.
|
|
25
|
+
export const CURRENT_PACKAGE_VERSION = '21.0.29';
|
|
26
26
|
// THIS FILE IS GENERATED - DO NOT MODIFY
|
|
27
27
|
//# sourceMappingURL=build-info._auto-generated_.js.map
|
package/lib-prod/index.d.ts
CHANGED
|
@@ -1,15 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export type Circ = Models__NS__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
|
+
export * from './json10';
|
package/lib-prod/index.js
CHANGED
|
@@ -1,56 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { walk } from 'lodash-walk-object/lib-prod';
|
|
3
|
-
import { CLASS } from 'typescript-class-helpers/lib-prod';
|
|
4
|
-
// import { Log } from 'ng2-logger'
|
|
5
|
-
// const log = Log.create('JSON10')
|
|
6
|
-
// let counter = 0
|
|
7
|
-
export class JSON10 {
|
|
8
|
-
static structureArray(anyJSON, options) {
|
|
9
|
-
let pathes = [];
|
|
10
|
-
const { include, exclude } = options || {};
|
|
11
|
-
walk.Object(anyJSON, (value, lodashPath) => {
|
|
12
|
-
if (!___NS__isUndefined(value)) {
|
|
13
|
-
pathes.push(lodashPath);
|
|
14
|
-
}
|
|
15
|
-
}, { include, exclude, checkCircural: true });
|
|
16
|
-
return pathes;
|
|
17
|
-
}
|
|
18
|
-
static cleaned(json, onCircs, options) {
|
|
19
|
-
// console.log('BETTER SRUGUB', json)
|
|
20
|
-
const result = ___NS__isArray(json) ? [] : {};
|
|
21
|
-
const classFN = CLASS.OBJECT(json).isClassObject && CLASS.getFromObject(json);
|
|
22
|
-
const { exclude, include, breadthWalk } = options || { exclude: [], include: [], breadthWalk: false };
|
|
23
|
-
const { circs } = walk.Object(json, (value, lodashPath, changeValueTo, options) => {
|
|
24
|
-
if (___NS__isObject(value) && options.isCircural) {
|
|
25
|
-
___NS__set(result, lodashPath, null);
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
___NS__set(result, lodashPath, ___NS__cloneDeep(value));
|
|
29
|
-
}
|
|
30
|
-
}, { include, exclude, breadthWalk, checkCircural: true });
|
|
31
|
-
if (___NS__isFunction(onCircs)) {
|
|
32
|
-
onCircs(circs);
|
|
33
|
-
}
|
|
34
|
-
return ___NS__isFunction(classFN) ? ___NS__merge(new classFN(), result) : result;
|
|
35
|
-
}
|
|
36
|
-
static stringify(anyJSON, replace, spaces, onCircs) {
|
|
37
|
-
const json = this.cleaned(anyJSON, onCircs);
|
|
38
|
-
return JSON.stringify(json, replace, spaces);
|
|
39
|
-
}
|
|
40
|
-
static parse(json, circs = []) {
|
|
41
|
-
let res = JSON.parse(json);
|
|
42
|
-
if (___NS__isArray(circs)) {
|
|
43
|
-
circs.forEach(({ circuralTargetPath, pathToObj }) => {
|
|
44
|
-
if (circuralTargetPath === '') {
|
|
45
|
-
___NS__set(res, pathToObj, res);
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
let v = ___NS__get(res, circuralTargetPath);
|
|
49
|
-
___NS__set(res, pathToObj, v);
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
return res;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
1
|
+
export * from './json10';
|
|
56
2
|
//# sourceMappingURL=index.js.map
|
package/lib-prod/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":[""],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":[""],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { Circ } from 'lodash-walk-object/lib-prod';
|
|
2
|
+
import { Circ } from 'lodash-walk-object/lib-prod';
|
|
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
|
+
}): {};
|
|
13
|
+
static stringify(anyJSON: Object, replace?: any, spaces?: number, onCircs?: (circs: Circ[]) => any): string;
|
|
14
|
+
static applyCircularMapping(json: object, circs?: Circ[]): any;
|
|
15
|
+
static parse(json: string, circs?: Circ[]): any;
|
|
16
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ___NS__cloneDeep, ___NS__get, ___NS__isArray, ___NS__isFunction, ___NS__isObject, ___NS__isString, ___NS__isUndefined, ___NS__set } from 'tnp-core/lib-prod';
|
|
2
|
+
import { walk } from 'lodash-walk-object/lib-prod';
|
|
3
|
+
// import { Log } from 'ng2-logger'
|
|
4
|
+
// const log = Log.create('JSON10')
|
|
5
|
+
// let counter = 0
|
|
6
|
+
export class JSON10 {
|
|
7
|
+
static structureArray(anyJSON, options) {
|
|
8
|
+
let pathes = [];
|
|
9
|
+
const { include, exclude } = options || {};
|
|
10
|
+
walk.Object(anyJSON, (value, lodashPath) => {
|
|
11
|
+
if (!___NS__isUndefined(value)) {
|
|
12
|
+
pathes.push(lodashPath);
|
|
13
|
+
}
|
|
14
|
+
}, { include, exclude, checkCircural: true });
|
|
15
|
+
return pathes;
|
|
16
|
+
}
|
|
17
|
+
static cleaned(json, onCircs, options) {
|
|
18
|
+
// console.log('BETTER SRUGUB', json)
|
|
19
|
+
const result = ___NS__isArray(json) ? [] : {};
|
|
20
|
+
const { exclude, include, breadthWalk } = options || {
|
|
21
|
+
exclude: [],
|
|
22
|
+
include: [],
|
|
23
|
+
breadthWalk: false,
|
|
24
|
+
};
|
|
25
|
+
const { circs } = walk.Object(json, (value, lodashPath, changeValueTo, options) => {
|
|
26
|
+
if (___NS__isObject(value) && options.isCircural) {
|
|
27
|
+
___NS__set(result, lodashPath, null);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
___NS__set(result, lodashPath, ___NS__cloneDeep(value));
|
|
31
|
+
}
|
|
32
|
+
}, { include, exclude, breadthWalk, checkCircural: true });
|
|
33
|
+
if (___NS__isFunction(onCircs)) {
|
|
34
|
+
onCircs(circs);
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
static stringify(anyJSON, replace, spaces, onCircs) {
|
|
39
|
+
const json = this.cleaned(anyJSON, onCircs);
|
|
40
|
+
return JSON.stringify(json, replace, spaces);
|
|
41
|
+
}
|
|
42
|
+
static applyCircularMapping(json, circs = []) {
|
|
43
|
+
if (circs && ___NS__isArray(circs)) {
|
|
44
|
+
circs.forEach(({ circuralTargetPath, pathToObj }) => {
|
|
45
|
+
if (___NS__isString(circuralTargetPath)) {
|
|
46
|
+
if (circuralTargetPath === '') {
|
|
47
|
+
___NS__set(json, pathToObj, json);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
let v = ___NS__get(json, circuralTargetPath);
|
|
51
|
+
___NS__set(json, pathToObj, v);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
___NS__set(json, pathToObj, circuralTargetPath);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return json;
|
|
60
|
+
}
|
|
61
|
+
static parse(json, circs = []) {
|
|
62
|
+
let res = JSON.parse(json);
|
|
63
|
+
res = JSON10.applyCircularMapping(res, circs);
|
|
64
|
+
return res;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=json10.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json10.js","sourceRoot":"","sources":[""],"names":[],"mappings":"AAAA,OAAO,EAAmU,gBAAgB,EAAumC,UAAU,EAA4T,cAAc,EAA+N,iBAAiB,EAAoK,eAAe,EAAkG,eAAe,EAAwC,kBAAkB,EAA+qC,UAAU,EAA84C,MAAM,mBAAmB,CAAC;AACp8J,OAAO,EAA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;IAEM,MAAM,CAAC,KAAK,CAAC,IAAY,EAAE,QAAgB,EAAE;QAClD,IAAI,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3B,GAAG,GAAG,MAAM,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC9C,OAAO,GAAG,CAAC;IACb,CAAC;CACF"}
|
package/lib-prod/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { _ } from 'tnp-core/websql';
|
|
2
2
|
import { walk } from 'lodash-walk-object/websql';
|
|
3
|
-
import { CLASS } from 'typescript-class-helpers/websql';
|
|
4
3
|
|
|
5
4
|
// import { Log } from 'ng2-logger'
|
|
6
5
|
// const log = Log.create('JSON10')
|
|
@@ -19,8 +18,11 @@ class JSON10 {
|
|
|
19
18
|
static cleaned(json, onCircs, options) {
|
|
20
19
|
// console.log('BETTER SRUGUB', json)
|
|
21
20
|
const result = _.isArray(json) ? [] : {};
|
|
22
|
-
const
|
|
23
|
-
|
|
21
|
+
const { exclude, include, breadthWalk } = options || {
|
|
22
|
+
exclude: [],
|
|
23
|
+
include: [],
|
|
24
|
+
breadthWalk: false,
|
|
25
|
+
};
|
|
24
26
|
const { circs } = walk.Object(json, (value, lodashPath, changeValueTo, options) => {
|
|
25
27
|
if (_.isObject(value) && options.isCircural) {
|
|
26
28
|
_.set(result, lodashPath, null);
|
|
@@ -32,25 +34,34 @@ class JSON10 {
|
|
|
32
34
|
if (_.isFunction(onCircs)) {
|
|
33
35
|
onCircs(circs);
|
|
34
36
|
}
|
|
35
|
-
return
|
|
37
|
+
return result;
|
|
36
38
|
}
|
|
37
39
|
static stringify(anyJSON, replace, spaces, onCircs) {
|
|
38
40
|
const json = this.cleaned(anyJSON, onCircs);
|
|
39
41
|
return JSON.stringify(json, replace, spaces);
|
|
40
42
|
}
|
|
41
|
-
static
|
|
42
|
-
|
|
43
|
-
if (_.isArray(circs)) {
|
|
43
|
+
static applyCircularMapping(json, circs = []) {
|
|
44
|
+
if (circs && _.isArray(circs)) {
|
|
44
45
|
circs.forEach(({ circuralTargetPath, pathToObj }) => {
|
|
45
|
-
if (circuralTargetPath
|
|
46
|
-
|
|
46
|
+
if (_.isString(circuralTargetPath)) {
|
|
47
|
+
if (circuralTargetPath === '') {
|
|
48
|
+
_.set(json, pathToObj, json);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
let v = _.get(json, circuralTargetPath);
|
|
52
|
+
_.set(json, pathToObj, v);
|
|
53
|
+
}
|
|
47
54
|
}
|
|
48
55
|
else {
|
|
49
|
-
|
|
50
|
-
_.set(res, pathToObj, v);
|
|
56
|
+
_.set(json, pathToObj, circuralTargetPath);
|
|
51
57
|
}
|
|
52
58
|
});
|
|
53
59
|
}
|
|
60
|
+
return json;
|
|
61
|
+
}
|
|
62
|
+
static parse(json, circs = []) {
|
|
63
|
+
let res = JSON.parse(json);
|
|
64
|
+
res = JSON10.applyCircularMapping(res, circs);
|
|
54
65
|
return res;
|
|
55
66
|
}
|
|
56
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json10-websql.mjs","sources":["../../../tmp-libs-for-dist-websql/json10/projects/json10/src/lib/
|
|
1
|
+
{"version":3,"file":"json10-websql.mjs","sources":["../../../tmp-libs-for-dist-websql/json10/projects/json10/src/lib/json10.ts","../../../tmp-libs-for-dist-websql/json10/projects/json10/src/json10-websql.ts"],"sourcesContent":["import { _ } from 'tnp-core/websql';\nimport { walk, Models } from 'lodash-walk-object/websql';\nexport { Circ } from 'lodash-walk-object/websql';\nimport { Circ } from 'lodash-walk-object/websql';\nimport { CLASS } from 'typescript-class-helpers/websql';\n// import { Log } from 'ng2-logger'\n// const log = Log.create('JSON10')\n\n// let counter = 0\n\nexport class JSON10 {\n public static structureArray(\n anyJSON: Object,\n options?: { include?: string[]; exclude?: string[] },\n ) {\n let pathes = [];\n const { include, exclude } = options || ({} as any);\n walk.Object(\n anyJSON,\n (value, lodashPath) => {\n if (!_.isUndefined(value)) {\n pathes.push(lodashPath);\n }\n },\n { include, exclude, checkCircural: true },\n );\n return pathes;\n }\n\n public static cleaned(\n json,\n onCircs?: (circs: Circ[]) => any,\n options?: {\n exclude?: string[];\n include?: string[];\n breadthWalk?: boolean;\n },\n ) {\n // console.log('BETTER SRUGUB', json)\n const result = _.isArray(json) ? [] : {};\n\n const { exclude, include, breadthWalk } = options || {\n exclude: [],\n include: [],\n breadthWalk: false,\n };\n\n const { circs } = walk.Object(\n json,\n (value, lodashPath, changeValueTo, options) => {\n if (_.isObject(value) && options.isCircural) {\n _.set(result, lodashPath, null);\n } else {\n _.set(result, lodashPath, _.cloneDeep(value));\n }\n },\n { include, exclude, breadthWalk, checkCircural: true },\n );\n\n if (_.isFunction(onCircs)) {\n onCircs(circs);\n }\n\n return result;\n }\n\n public static stringify(\n anyJSON: Object,\n replace?: any,\n spaces?: number,\n onCircs?: (circs: Circ[]) => any,\n ): string {\n const json = this.cleaned(anyJSON, onCircs);\n return JSON.stringify(json, replace, spaces);\n }\n\n public static applyCircularMapping(json: object, circs: Circ[] = []): any {\n if (circs && _.isArray(circs)) {\n circs.forEach(({ circuralTargetPath, pathToObj }) => {\n if (_.isString(circuralTargetPath)) {\n if (circuralTargetPath === '') {\n _.set(json, pathToObj, json);\n } else {\n let v = _.get(json, circuralTargetPath);\n _.set(json, pathToObj, v);\n }\n } else {\n _.set(json, pathToObj, circuralTargetPath);\n }\n });\n }\n return json;\n }\n\n public static parse(json: string, circs: Circ[] = []): any {\n let res = JSON.parse(json);\n res = JSON10.applyCircularMapping(res, circs);\n return res;\n }\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAKA;AACA;AAEA;MAEa,MAAM,CAAA;AACV,IAAA,OAAO,cAAc,CAC1B,OAAe,EACf,OAAoD,EAAA;QAEpD,IAAI,MAAM,GAAG,EAAE;QACf,MAAM,EAAE,OAAO,EA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ANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import {
|
|
2
|
+
import { Circ } from 'lodash-walk-object/websql';
|
|
3
|
+
export { Circ } from 'lodash-walk-object/websql';
|
|
3
4
|
|
|
4
|
-
type Circ = Models.Circ;
|
|
5
5
|
declare class JSON10 {
|
|
6
6
|
static structureArray(anyJSON: Object, options?: {
|
|
7
7
|
include?: string[];
|
|
@@ -11,10 +11,10 @@ declare class JSON10 {
|
|
|
11
11
|
exclude?: string[];
|
|
12
12
|
include?: string[];
|
|
13
13
|
breadthWalk?: boolean;
|
|
14
|
-
}):
|
|
14
|
+
}): {};
|
|
15
15
|
static stringify(anyJSON: Object, replace?: any, spaces?: number, onCircs?: (circs: Circ[]) => any): string;
|
|
16
|
+
static applyCircularMapping(json: object, circs?: Circ[]): any;
|
|
16
17
|
static parse(json: string, circs?: Circ[]): any;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
export { JSON10 };
|
|
20
|
-
export type { Circ };
|
|
20
|
+
export { JSON10 };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { ___NS__isUndefined, ___NS__isArray, ___NS__isObject, ___NS__set, ___NS__cloneDeep, ___NS__isFunction,
|
|
1
|
+
import { ___NS__isUndefined, ___NS__isArray, ___NS__isObject, ___NS__set, ___NS__cloneDeep, ___NS__isFunction, ___NS__isString, ___NS__get } from 'tnp-core/websql-prod';
|
|
2
2
|
import { walk } from 'lodash-walk-object/websql-prod';
|
|
3
|
-
import { CLASS } from 'typescript-class-helpers/websql-prod';
|
|
4
3
|
|
|
5
4
|
// import { Log } from 'ng2-logger'
|
|
6
5
|
// const log = Log.create('JSON10')
|
|
@@ -19,8 +18,11 @@ class JSON10 {
|
|
|
19
18
|
static cleaned(json, onCircs, options) {
|
|
20
19
|
// console.log('BETTER SRUGUB', json)
|
|
21
20
|
const result = ___NS__isArray(json) ? [] : {};
|
|
22
|
-
const
|
|
23
|
-
|
|
21
|
+
const { exclude, include, breadthWalk } = options || {
|
|
22
|
+
exclude: [],
|
|
23
|
+
include: [],
|
|
24
|
+
breadthWalk: false,
|
|
25
|
+
};
|
|
24
26
|
const { circs } = walk.Object(json, (value, lodashPath, changeValueTo, options) => {
|
|
25
27
|
if (___NS__isObject(value) && options.isCircural) {
|
|
26
28
|
___NS__set(result, lodashPath, null);
|
|
@@ -32,25 +34,34 @@ class JSON10 {
|
|
|
32
34
|
if (___NS__isFunction(onCircs)) {
|
|
33
35
|
onCircs(circs);
|
|
34
36
|
}
|
|
35
|
-
return
|
|
37
|
+
return result;
|
|
36
38
|
}
|
|
37
39
|
static stringify(anyJSON, replace, spaces, onCircs) {
|
|
38
40
|
const json = this.cleaned(anyJSON, onCircs);
|
|
39
41
|
return JSON.stringify(json, replace, spaces);
|
|
40
42
|
}
|
|
41
|
-
static
|
|
42
|
-
|
|
43
|
-
if (___NS__isArray(circs)) {
|
|
43
|
+
static applyCircularMapping(json, circs = []) {
|
|
44
|
+
if (circs && ___NS__isArray(circs)) {
|
|
44
45
|
circs.forEach(({ circuralTargetPath, pathToObj }) => {
|
|
45
|
-
if (circuralTargetPath
|
|
46
|
-
|
|
46
|
+
if (___NS__isString(circuralTargetPath)) {
|
|
47
|
+
if (circuralTargetPath === '') {
|
|
48
|
+
___NS__set(json, pathToObj, json);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
let v = ___NS__get(json, circuralTargetPath);
|
|
52
|
+
___NS__set(json, pathToObj, v);
|
|
53
|
+
}
|
|
47
54
|
}
|
|
48
55
|
else {
|
|
49
|
-
|
|
50
|
-
___NS__set(res, pathToObj, v);
|
|
56
|
+
___NS__set(json, pathToObj, circuralTargetPath);
|
|
51
57
|
}
|
|
52
58
|
});
|
|
53
59
|
}
|
|
60
|
+
return json;
|
|
61
|
+
}
|
|
62
|
+
static parse(json, circs = []) {
|
|
63
|
+
let res = JSON.parse(json);
|
|
64
|
+
res = JSON10.applyCircularMapping(res, circs);
|
|
54
65
|
return res;
|
|
55
66
|
}
|
|
56
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json10-websql.mjs","sources":["../../../tmp-libs-for-dist-websql-prod/json10/projects/json10/src/lib/index.ts","../../../tmp-libs-for-dist-websql-prod/json10/projects/json10/src/json10-websql.ts"],"sourcesContent":["import { ___NS__add, ___NS__after, ___NS__ary, ___NS__assign, ___NS__assignIn, ___NS__assignInWith, ___NS__assignWith, ___NS__at, ___NS__attempt, ___NS__before, ___NS__bind, ___NS__bindAll, ___NS__bindKey, ___NS__camelCase, ___NS__capitalize, ___NS__castArray, ___NS__ceil, ___NS__chain, ___NS__chunk, ___NS__clamp, ___NS__clone, ___NS__cloneDeep, ___NS__cloneDeepWith, ___NS__cloneWith, ___NS__compact, ___NS__concat, ___NS__cond, ___NS__conforms, ___NS__conformsTo, ___NS__constant, ___NS__countBy, ___NS__create, ___NS__curry, ___NS__curryRight, ___NS__debounce, ___NS__deburr, ___NS__defaults, ___NS__defaultsDeep, ___NS__defaultTo, ___NS__defer, ___NS__delay, ___NS__difference, ___NS__differenceBy, ___NS__differenceWith, ___NS__divide, ___NS__drop, ___NS__dropRight, ___NS__dropRightWhile, ___NS__dropWhile, ___NS__each, ___NS__eachRight, ___NS__endsWith, ___NS__entries, ___NS__entriesIn, ___NS__eq, ___NS__escape, ___NS__escapeRegExp, ___NS__every, ___NS__extend, ___NS__extendWith, ___NS__fill, ___NS__filter, ___NS__find, ___NS__findIndex, ___NS__findKey, ___NS__findLast, ___NS__findLastIndex, ___NS__findLastKey, ___NS__first, ___NS__flatMap, ___NS__flatMapDeep, ___NS__flatMapDepth, ___NS__flatten, ___NS__flattenDeep, ___NS__flattenDepth, ___NS__flip, ___NS__floor, ___NS__flow, ___NS__flowRight, ___NS__forEach, ___NS__forEachRight, ___NS__forIn, ___NS__forInRight, ___NS__forOwn, ___NS__forOwnRight, ___NS__fromPairs, ___NS__functions, ___NS__functionsIn, ___NS__get, ___NS__groupBy, ___NS__gt, ___NS__gte, ___NS__has, ___NS__hasIn, ___NS__head, ___NS__identity, ___NS__includes, ___NS__indexOf, ___NS__initial, ___NS__inRange, ___NS__intersection, ___NS__intersectionBy, ___NS__intersectionWith, ___NS__invert, ___NS__invertBy, ___NS__invoke, ___NS__invokeMap, ___NS__isArguments, ___NS__isArray, ___NS__isArrayBuffer, ___NS__isArrayLike, ___NS__isArrayLikeObject, ___NS__isBoolean, ___NS__isBuffer, ___NS__isDate, ___NS__isElement, ___NS__isEmpty, ___NS__isEqual, ___NS__isEqualWith, ___NS__isError, ___NS__isFinite, ___NS__isFunction, ___NS__isInteger, ___NS__isLength, ___NS__isMap, ___NS__isMatch, ___NS__isMatchWith, ___NS__isNaN, ___NS__isNative, ___NS__isNil, ___NS__isNull, ___NS__isNumber, ___NS__isObject, ___NS__isObjectLike, ___NS__isPlainObject, ___NS__isRegExp, ___NS__isSafeInteger, ___NS__isSet, ___NS__isString, ___NS__isSymbol, ___NS__isTypedArray, ___NS__isUndefined, ___NS__isWeakMap, ___NS__isWeakSet, ___NS__iteratee, ___NS__join, ___NS__kebabCase, ___NS__keyBy, ___NS__keys, ___NS__keysIn, ___NS__last, ___NS__lastIndexOf, ___NS__lowerCase, ___NS__lowerFirst, ___NS__lt, ___NS__lte, ___NS__map, ___NS__mapKeys, ___NS__mapValues, ___NS__matches, ___NS__matchesProperty, ___NS__max, ___NS__maxBy, ___NS__mean, ___NS__meanBy, ___NS__memoize, ___NS__merge, ___NS__mergeWith, ___NS__method, ___NS__methodOf, ___NS__min, ___NS__minBy, ___NS__mixin, ___NS__multiply, ___NS__negate, ___NS__noop, ___NS__now, ___NS__nth, ___NS__nthArg, ___NS__omit, ___NS__omitBy, ___NS__once, ___NS__orderBy, ___NS__over, ___NS__overArgs, ___NS__overEvery, ___NS__overSome, ___NS__pad, ___NS__padEnd, ___NS__padStart, ___NS__parseInt, ___NS__partial, ___NS__partialRight, ___NS__partition, ___NS__pick, ___NS__pickBy, ___NS__property, ___NS__propertyOf, ___NS__pull, ___NS__pullAll, ___NS__pullAllBy, ___NS__pullAllWith, ___NS__pullAt, ___NS__random, ___NS__range, ___NS__rangeRight, ___NS__rearg, ___NS__reduce, ___NS__reduceRight, ___NS__reject, ___NS__remove, ___NS__repeat, ___NS__replace, ___NS__rest, ___NS__result, ___NS__reverse, ___NS__round, ___NS__sample, ___NS__sampleSize, ___NS__set, ___NS__setWith, ___NS__shuffle, ___NS__size, ___NS__slice, ___NS__snakeCase, ___NS__some, ___NS__sortBy, ___NS__sortedIndex, ___NS__sortedIndexBy, ___NS__sortedIndexOf, ___NS__sortedLastIndex, ___NS__sortedLastIndexBy, ___NS__sortedLastIndexOf, ___NS__sortedUniq, ___NS__sortedUniqBy, ___NS__split, ___NS__spread, ___NS__startCase, ___NS__startsWith, ___NS__stubArray, ___NS__stubFalse, ___NS__stubObject, ___NS__stubString, ___NS__stubTrue, ___NS__subtract, ___NS__sum, ___NS__sumBy, ___NS__tail, ___NS__take, ___NS__takeRight, ___NS__takeRightWhile, ___NS__takeWhile, ___NS__tap, ___NS__template, ___NS__templateSettings, ___NS__throttle, ___NS__thru, ___NS__times, ___NS__toArray, ___NS__toFinite, ___NS__toInteger, ___NS__toLength, ___NS__toLower, ___NS__toNumber, ___NS__toPairs, ___NS__toPairsIn, ___NS__toPath, ___NS__toPlainObject, ___NS__toSafeInteger, ___NS__toString, ___NS__toUpper, ___NS__transform, ___NS__trim, ___NS__trimEnd, ___NS__trimStart, ___NS__truncate, ___NS__unary, ___NS__unescape, ___NS__union, ___NS__unionBy, ___NS__unionWith, ___NS__uniq, ___NS__uniqBy, ___NS__uniqueId, ___NS__uniqWith, ___NS__unset, ___NS__unzip, ___NS__unzipWith, ___NS__update, ___NS__updateWith, ___NS__upperCase, ___NS__upperFirst, ___NS__values, ___NS__valuesIn, ___NS__without, ___NS__words, ___NS__wrap, ___NS__xor, ___NS__xorBy, ___NS__xorWith, ___NS__zip, ___NS__zipObject, ___NS__zipObjectDeep, ___NS__zipWith } from 'tnp-core/websql-prod';\nimport { walk, Models__NS__AdditionalIteratorOptions, Models__NS__Circ, Models__NS__InDBType, Models__NS__InternalValues, Models__NS__StartIteratorOptions, Models__NS__Ver } from 'lodash-walk-object/websql-prod';\nexport type Circ = Models__NS__Circ;\nimport { CLASS } from 'typescript-class-helpers/websql-prod';\n// import { Log } from 'ng2-logger'\n// const log = Log.create('JSON10')\n\n// let counter = 0\n\nexport class JSON10 {\n\n public static structureArray(anyJSON: Object, options?: { include?: string[]; exclude?: string[] }) {\n let pathes = []\n const { include, exclude } = options || {} as any;\n walk.Object(anyJSON, (value, lodashPath) => {\n\n if (!___NS__isUndefined(value)) {\n pathes.push(lodashPath)\n }\n\n }, { include, exclude, checkCircural: true })\n return pathes;\n }\n\n\n public static cleaned(json, onCircs?: (circs: Circ[]) => any, options?:\n {\n exclude?: string[];\n include?: string[];\n breadthWalk?: boolean;\n }) {\n // console.log('BETTER SRUGUB', json)\n const result = ___NS__isArray(json) ? [] : {}\n const classFN = CLASS.OBJECT(json).isClassObject && CLASS.getFromObject(json);\n\n const { exclude, include, breadthWalk } = options || { exclude: [], include: [], breadthWalk: false };\n\n const { circs } = walk.Object(json, (value, lodashPath, changeValueTo, options) => {\n\n if (___NS__isObject(value) && options.isCircural) {\n ___NS__set(result, lodashPath, null)\n } else {\n ___NS__set(result, lodashPath, ___NS__cloneDeep(value))\n }\n\n }, { include, exclude, breadthWalk, checkCircural: true });\n\n if (___NS__isFunction(onCircs)) {\n onCircs(circs)\n }\n\n return ___NS__isFunction(classFN) ? ___NS__merge(new (classFN as any)(), result) : result;\n }\n\n public static stringify(anyJSON: Object, replace?: any, spaces?: number, onCircs?: (circs: Circ[]) => any) {\n const json = this.cleaned(anyJSON, onCircs);\n return JSON.stringify(json, replace, spaces);\n }\n\n public static parse(json: string, circs: Circ[] = []) {\n let res = JSON.parse(json);\n if (___NS__isArray(circs)) {\n circs.forEach(({ circuralTargetPath, pathToObj }) => {\n\n if (circuralTargetPath === '') {\n ___NS__set(res, pathToObj, res)\n } else {\n let v = ___NS__get(res, circuralTargetPath);\n ___NS__set(res, pathToObj, v)\n }\n\n })\n }\n return res;\n }\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAIA;AACA;AAEA;MAEa,MAAM,CAAA;AAEV,IAAA,OAAO,cAAc,CAAC,OAAe,EAAE,OAAoD,EAAA;QAChG,IAAI,MAAM,GAAG,EAAE;QACf,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO,IAAI,EAAS;QACjD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,KAAI;AAEzC,YAAA,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE;AAC9B,gBAAA,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;YACzB;QAEF,CAAC,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;AAC7C,QAAA,OAAO,MAAM;IACf;AAGO,IAAA,OAAO,OAAO,CAAC,IAAI,EAAE,OAAgC,EAAE,OAK3D,EAAA;;AAED,QAAA,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE;AAC7C,QAAA,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,aAAa,IAAI,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC;QAE7E,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,OAAO,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE;AAErG,QAAA,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,OAAO,KAAI;YAEhF,IAAI,eAAe,CAAC,KAAK,CAA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AAC,CAAC;QACJ;AACA,QAAA,OAAO,GAAG;IACZ;AACD;;AC3ED;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"json10-websql.mjs","sources":["../../../tmp-libs-for-dist-websql-prod/json10/projects/json10/src/lib/json10.ts","../../../tmp-libs-for-dist-websql-prod/json10/projects/json10/src/json10-websql.ts"],"sourcesContent":["import { ___NS__add, ___NS__after, ___NS__ary, ___NS__assign, ___NS__assignIn, ___NS__assignInWith, ___NS__assignWith, ___NS__at, ___NS__attempt, ___NS__before, ___NS__bind, ___NS__bindAll, ___NS__bindKey, ___NS__camelCase, ___NS__capitalize, ___NS__castArray, ___NS__ceil, ___NS__chain, ___NS__chunk, ___NS__clamp, ___NS__clone, ___NS__cloneDeep, ___NS__cloneDeepWith, ___NS__cloneWith, ___NS__compact, ___NS__concat, ___NS__cond, ___NS__conforms, ___NS__conformsTo, ___NS__constant, ___NS__countBy, ___NS__create, ___NS__curry, ___NS__curryRight, ___NS__debounce, ___NS__deburr, ___NS__defaults, ___NS__defaultsDeep, ___NS__defaultTo, ___NS__defer, ___NS__delay, ___NS__difference, ___NS__differenceBy, ___NS__differenceWith, ___NS__divide, ___NS__drop, ___NS__dropRight, ___NS__dropRightWhile, ___NS__dropWhile, ___NS__each, ___NS__eachRight, ___NS__endsWith, ___NS__entries, ___NS__entriesIn, ___NS__eq, ___NS__escape, ___NS__escapeRegExp, ___NS__every, ___NS__extend, ___NS__extendWith, ___NS__fill, ___NS__filter, ___NS__find, ___NS__findIndex, ___NS__findKey, ___NS__findLast, ___NS__findLastIndex, ___NS__findLastKey, ___NS__first, ___NS__flatMap, ___NS__flatMapDeep, ___NS__flatMapDepth, ___NS__flatten, ___NS__flattenDeep, ___NS__flattenDepth, ___NS__flip, ___NS__floor, ___NS__flow, ___NS__flowRight, ___NS__forEach, ___NS__forEachRight, ___NS__forIn, ___NS__forInRight, ___NS__forOwn, ___NS__forOwnRight, ___NS__fromPairs, ___NS__functions, ___NS__functionsIn, ___NS__get, ___NS__groupBy, ___NS__gt, ___NS__gte, ___NS__has, ___NS__hasIn, ___NS__head, ___NS__identity, ___NS__includes, ___NS__indexOf, ___NS__initial, ___NS__inRange, ___NS__intersection, ___NS__intersectionBy, ___NS__intersectionWith, ___NS__invert, ___NS__invertBy, ___NS__invoke, ___NS__invokeMap, ___NS__isArguments, ___NS__isArray, ___NS__isArrayBuffer, ___NS__isArrayLike, ___NS__isArrayLikeObject, ___NS__isBoolean, ___NS__isBuffer, ___NS__isDate, ___NS__isElement, ___NS__isEmpty, ___NS__isEqual, ___NS__isEqualWith, ___NS__isError, ___NS__isFinite, ___NS__isFunction, ___NS__isInteger, ___NS__isLength, ___NS__isMap, ___NS__isMatch, ___NS__isMatchWith, ___NS__isNaN, ___NS__isNative, ___NS__isNil, ___NS__isNull, ___NS__isNumber, ___NS__isObject, ___NS__isObjectLike, ___NS__isPlainObject, ___NS__isRegExp, ___NS__isSafeInteger, ___NS__isSet, ___NS__isString, ___NS__isSymbol, ___NS__isTypedArray, ___NS__isUndefined, ___NS__isWeakMap, ___NS__isWeakSet, ___NS__iteratee, ___NS__join, ___NS__kebabCase, ___NS__keyBy, ___NS__keys, ___NS__keysIn, ___NS__last, ___NS__lastIndexOf, ___NS__lowerCase, ___NS__lowerFirst, ___NS__lt, ___NS__lte, ___NS__map, ___NS__mapKeys, ___NS__mapValues, ___NS__matches, ___NS__matchesProperty, ___NS__max, ___NS__maxBy, ___NS__mean, ___NS__meanBy, ___NS__memoize, ___NS__merge, ___NS__mergeWith, ___NS__method, ___NS__methodOf, ___NS__min, ___NS__minBy, ___NS__mixin, ___NS__multiply, ___NS__negate, ___NS__noop, ___NS__now, ___NS__nth, ___NS__nthArg, ___NS__omit, ___NS__omitBy, ___NS__once, ___NS__orderBy, ___NS__over, ___NS__overArgs, ___NS__overEvery, ___NS__overSome, ___NS__pad, ___NS__padEnd, ___NS__padStart, ___NS__parseInt, ___NS__partial, ___NS__partialRight, ___NS__partition, ___NS__pick, ___NS__pickBy, ___NS__property, ___NS__propertyOf, ___NS__pull, ___NS__pullAll, ___NS__pullAllBy, ___NS__pullAllWith, ___NS__pullAt, ___NS__random, ___NS__range, ___NS__rangeRight, ___NS__rearg, ___NS__reduce, ___NS__reduceRight, ___NS__reject, ___NS__remove, ___NS__repeat, ___NS__replace, ___NS__rest, ___NS__result, ___NS__reverse, ___NS__round, ___NS__sample, ___NS__sampleSize, ___NS__set, ___NS__setWith, ___NS__shuffle, ___NS__size, ___NS__slice, ___NS__snakeCase, ___NS__some, ___NS__sortBy, ___NS__sortedIndex, ___NS__sortedIndexBy, ___NS__sortedIndexOf, ___NS__sortedLastIndex, ___NS__sortedLastIndexBy, ___NS__sortedLastIndexOf, ___NS__sortedUniq, ___NS__sortedUniqBy, ___NS__split, ___NS__spread, ___NS__startCase, ___NS__startsWith, ___NS__stubArray, ___NS__stubFalse, ___NS__stubObject, ___NS__stubString, ___NS__stubTrue, ___NS__subtract, ___NS__sum, ___NS__sumBy, ___NS__tail, ___NS__take, ___NS__takeRight, ___NS__takeRightWhile, ___NS__takeWhile, ___NS__tap, ___NS__template, ___NS__templateSettings, ___NS__throttle, ___NS__thru, ___NS__times, ___NS__toArray, ___NS__toFinite, ___NS__toInteger, ___NS__toLength, ___NS__toLower, ___NS__toNumber, ___NS__toPairs, ___NS__toPairsIn, ___NS__toPath, ___NS__toPlainObject, ___NS__toSafeInteger, ___NS__toString, ___NS__toUpper, ___NS__transform, ___NS__trim, ___NS__trimEnd, ___NS__trimStart, ___NS__truncate, ___NS__unary, ___NS__unescape, ___NS__union, ___NS__unionBy, ___NS__unionWith, ___NS__uniq, ___NS__uniqBy, ___NS__uniqueId, ___NS__uniqWith, ___NS__unset, ___NS__unzip, ___NS__unzipWith, ___NS__update, ___NS__updateWith, ___NS__upperCase, ___NS__upperFirst, ___NS__values, ___NS__valuesIn, ___NS__without, ___NS__words, ___NS__wrap, ___NS__xor, ___NS__xorBy, ___NS__xorWith, ___NS__zip, ___NS__zipObject, ___NS__zipObjectDeep, ___NS__zipWith } from 'tnp-core/websql-prod';\nimport { walk, Models__NS__AdditionalIteratorOptions, Models__NS__InDBType, Models__NS__InternalValues, Models__NS__StartIteratorOptions, Models__NS__Ver } from 'lodash-walk-object/websql-prod';\nexport { Circ } from 'lodash-walk-object/websql-prod';\nimport { Circ } from 'lodash-walk-object/websql-prod';\nimport { CLASS__NS__getBy, CLASS__NS__getClassNameFromObjInstanceOrClassFn, CLASS__NS__getMethodsNames, CLASS__NS__getName, CLASS__NS__getNameFromObject, CLASS__NS__NAME, CLASS__NS__setClassName, CLASS__NS__setName } from 'typescript-class-helpers/websql-prod';\n// import { Log } from 'ng2-logger'\n// const log = Log.create('JSON10')\n\n// let counter = 0\n\nexport class JSON10 {\n public static structureArray(\n anyJSON: Object,\n options?: { include?: string[]; exclude?: string[] },\n ) {\n let pathes = [];\n const { include, exclude } = options || ({} as any);\n walk.Object(\n anyJSON,\n (value, lodashPath) => {\n if (!___NS__isUndefined(value)) {\n pathes.push(lodashPath);\n }\n },\n { include, exclude, checkCircural: true },\n );\n return pathes;\n }\n\n public static cleaned(\n json,\n onCircs?: (circs: Circ[]) => any,\n options?: {\n exclude?: string[];\n include?: string[];\n breadthWalk?: boolean;\n },\n ) {\n // console.log('BETTER SRUGUB', json)\n const result = ___NS__isArray(json) ? [] : {};\n\n const { exclude, include, breadthWalk } = options || {\n exclude: [],\n include: [],\n breadthWalk: false,\n };\n\n const { circs } = walk.Object(\n json,\n (value, lodashPath, changeValueTo, options) => {\n if (___NS__isObject(value) && options.isCircural) {\n ___NS__set(result, lodashPath, null);\n } else {\n ___NS__set(result, lodashPath, ___NS__cloneDeep(value));\n }\n },\n { include, exclude, breadthWalk, checkCircural: true },\n );\n\n if (___NS__isFunction(onCircs)) {\n onCircs(circs);\n }\n\n return result;\n }\n\n public static stringify(\n anyJSON: Object,\n replace?: any,\n spaces?: number,\n onCircs?: (circs: Circ[]) => any,\n ): string {\n const json = this.cleaned(anyJSON, onCircs);\n return JSON.stringify(json, replace, spaces);\n }\n\n public static applyCircularMapping(json: object, circs: Circ[] = []): any {\n if (circs && ___NS__isArray(circs)) {\n circs.forEach(({ circuralTargetPath, pathToObj }) => {\n if (___NS__isString(circuralTargetPath)) {\n if (circuralTargetPath === '') {\n ___NS__set(json, pathToObj, json);\n } else {\n let v = ___NS__get(json, circuralTargetPath);\n ___NS__set(json, pathToObj, v);\n }\n } else {\n ___NS__set(json, pathToObj, circuralTargetPath);\n }\n });\n }\n return json;\n }\n\n public static parse(json: string, circs: Circ[] = []): any {\n let res = JSON.parse(json);\n res = JSON10.applyCircularMapping(res, circs);\n return res;\n }\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAKA;AACA;AAEA;MAEa,MAAM,CAAA;AACV,IAAA,OAAO,cAAc,CAC1B,OAAe,EACf,OAAoD,EAAA;QAEpD,IAAI,MAAM,GAAG,EAAE;QACf,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO,IAAK,EAAU;QACnD,IAAI,CAAC,MAAM,CACT,OAAO,EACP,CAAC,KAAK,EAAE,UAAU,KAAI;AACpB,YAAA,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE;AAC9B,gBAAA,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;YACzB;QACF,CAAC,EACD,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,CAC1C;AACD,QAAA,OAAO,MAAM;IACf;AAEO,IAAA,OAAO,OAAO,CACnB,IAAI,EACJ,OAAgC,EAChC,OAIC,EAAA;;AAGD,QAAA,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE;QAE7C,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,OAAO,IAAI;AACnD,YAAA,OAAO,EAAE,EAAE;AACX,YAAA,OAAO,EAAE,EAAE;AACX,YAAA,WAAW,EAAE,KA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;AAC5C,wBAAA,UAAU,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;oBAChC;gBACF;qBAAO;AACL,oBAAA,UAAU,CAAC,IAAI,EAAE,SAAS,EAAE,kBAAkB,CAAC;gBACjD;AACF,YAAA,CAAC,CAAC;QACJ;AACA,QAAA,OAAO,IAAI;IACb;AAEO,IAAA,OAAO,KAAK,CAAC,IAAY,EAAE,QAAgB,EAAE,EAAA;QAClD,IAAI,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;QAC1B,GAAG,GAAG,MAAM,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,CAAC;AAC7C,QAAA,OAAO,GAAG;IACZ;AACD;;ACnGD;;AAEG;;;;"}
|
package/websql-prod/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import {
|
|
2
|
+
import { Circ } from 'lodash-walk-object/websql-prod';
|
|
3
|
+
export { Circ } from 'lodash-walk-object/websql-prod';
|
|
3
4
|
|
|
4
|
-
type Circ = Models__NS__Circ;
|
|
5
5
|
declare class JSON10 {
|
|
6
6
|
static structureArray(anyJSON: Object, options?: {
|
|
7
7
|
include?: string[];
|
|
@@ -11,10 +11,10 @@ declare class JSON10 {
|
|
|
11
11
|
exclude?: string[];
|
|
12
12
|
include?: string[];
|
|
13
13
|
breadthWalk?: boolean;
|
|
14
|
-
}):
|
|
14
|
+
}): {};
|
|
15
15
|
static stringify(anyJSON: Object, replace?: any, spaces?: number, onCircs?: (circs: Circ[]) => any): string;
|
|
16
|
+
static applyCircularMapping(json: object, circs?: Circ[]): any;
|
|
16
17
|
static parse(json: string, circs?: Circ[]): any;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
export { JSON10 };
|
|
20
|
-
export type { Circ };
|
|
20
|
+
export { JSON10 };
|