@cleverbrush/deep 1.0.0-beta.6 → 1.1.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 +0 -4
- package/dist/deepEqual.d.ts +14 -0
- package/dist/deepEqual.js +16 -8
- package/dist/deepExtend.js +1 -3
- package/dist/hashObject.js +1 -5
- package/dist/index.js +6 -13
- package/package.json +27 -14
- package/src/deepEqual.test.ts +0 -69
- package/src/deepEqual.ts +0 -98
- package/src/deepExtend.ts +0 -70
- package/src/hashObject.ts +0 -47
- package/src/index.ts +0 -9
- package/tsconfig.json +0 -16
package/README.md
CHANGED
|
@@ -8,10 +8,6 @@ This is yet another library which provides operations over JavaScript objects, l
|
|
|
8
8
|
|
|
9
9
|
## Usage
|
|
10
10
|
|
|
11
|
-
const deep = require('@cleverbrush/deep');
|
|
12
|
-
|
|
13
|
-
or for ES Module
|
|
14
|
-
|
|
15
11
|
import deep from '@cleverbrush/deep';
|
|
16
12
|
// or import functions individually
|
|
17
13
|
import { deepEqual, deepExtend } from '@cleverbrush/deep';
|
package/dist/deepEqual.d.ts
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compares two objects and returns true if they
|
|
3
|
+
* have the same structure and values. Can work
|
|
4
|
+
* with arrays and objects, nested objects,
|
|
5
|
+
* recursive objects, dates, etc.
|
|
6
|
+
* @param p1 first object
|
|
7
|
+
* @param p2 second object
|
|
8
|
+
* @param options additional options
|
|
9
|
+
* @returns {boolean} `true` if the objects are equal, `false` otherwise
|
|
10
|
+
*/
|
|
1
11
|
declare const deepEqual: (p1: any, p2: any, options?: {
|
|
12
|
+
/**
|
|
13
|
+
* if true, the order of the elements in the array will be disregarded
|
|
14
|
+
* e.g. [1, 2] and [2, 1] will be considered equal
|
|
15
|
+
*/
|
|
2
16
|
disregardArrayOrder?: boolean;
|
|
3
17
|
}) => boolean;
|
|
4
18
|
export default deepEqual;
|
package/dist/deepEqual.js
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const hashObject_js_1 = require("./hashObject.js");
|
|
1
|
+
import { HashObject } from './hashObject.js';
|
|
4
2
|
const isBothNaN = function (v1, v2) {
|
|
5
3
|
return Number.isNaN(v1) && Number.isNaN(v2);
|
|
6
4
|
};
|
|
5
|
+
/**
|
|
6
|
+
* Compares two objects and returns true if they
|
|
7
|
+
* have the same structure and values. Can work
|
|
8
|
+
* with arrays and objects, nested objects,
|
|
9
|
+
* recursive objects, dates, etc.
|
|
10
|
+
* @param p1 first object
|
|
11
|
+
* @param p2 second object
|
|
12
|
+
* @param options additional options
|
|
13
|
+
* @returns {boolean} `true` if the objects are equal, `false` otherwise
|
|
14
|
+
*/
|
|
7
15
|
const deepEqual = function (p1, p2, options) {
|
|
8
16
|
const cache = new Map();
|
|
9
17
|
const compare = function (o1, o2) {
|
|
@@ -16,8 +24,8 @@ const deepEqual = function (p1, p2, options) {
|
|
|
16
24
|
? a1
|
|
17
25
|
.map((t) => t)
|
|
18
26
|
.sort((l, r) => {
|
|
19
|
-
const hash1 =
|
|
20
|
-
const hash2 =
|
|
27
|
+
const hash1 = HashObject(l);
|
|
28
|
+
const hash2 = HashObject(r);
|
|
21
29
|
return hash1 < hash2 ? 1 : -1;
|
|
22
30
|
})
|
|
23
31
|
: a1.map((t) => t);
|
|
@@ -25,8 +33,8 @@ const deepEqual = function (p1, p2, options) {
|
|
|
25
33
|
? a2
|
|
26
34
|
.map((t) => t)
|
|
27
35
|
.sort((l, r) => {
|
|
28
|
-
const hash1 =
|
|
29
|
-
const hash2 =
|
|
36
|
+
const hash1 = HashObject(l);
|
|
37
|
+
const hash2 = HashObject(r);
|
|
30
38
|
return hash1 < hash2 ? 1 : -1;
|
|
31
39
|
})
|
|
32
40
|
: a2.map((t) => t);
|
|
@@ -82,4 +90,4 @@ const deepEqual = function (p1, p2, options) {
|
|
|
82
90
|
};
|
|
83
91
|
return compare(p1, p2);
|
|
84
92
|
};
|
|
85
|
-
|
|
93
|
+
export default deepEqual;
|
package/dist/deepExtend.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
const deepExtend = function () {
|
|
4
2
|
if (arguments.length === 0)
|
|
5
3
|
return false;
|
|
@@ -37,4 +35,4 @@ const deepExtend = function () {
|
|
|
37
35
|
}
|
|
38
36
|
return result;
|
|
39
37
|
};
|
|
40
|
-
|
|
38
|
+
export default deepExtend;
|
package/dist/hashObject.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HashObject = void 0;
|
|
4
1
|
const stringHash = (string, noType) => {
|
|
5
2
|
let hashString = string;
|
|
6
3
|
if (!noType) {
|
|
@@ -29,7 +26,7 @@ function objectHash(obj, exclude) {
|
|
|
29
26
|
}
|
|
30
27
|
return stringHash(hash, true);
|
|
31
28
|
}
|
|
32
|
-
function HashObject(unkType, exclude) {
|
|
29
|
+
export function HashObject(unkType, exclude) {
|
|
33
30
|
let ex = exclude;
|
|
34
31
|
if (ex === undefined) {
|
|
35
32
|
ex = [];
|
|
@@ -44,5 +41,4 @@ function HashObject(unkType, exclude) {
|
|
|
44
41
|
return stringHash(String(unkType));
|
|
45
42
|
}
|
|
46
43
|
}
|
|
47
|
-
exports.HashObject = HashObject;
|
|
48
44
|
const hashFunc = HashObject;
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const deepEqual_1 = __importDefault(require("./deepEqual"));
|
|
8
|
-
exports.deepEqual = deepEqual_1.default;
|
|
9
|
-
const deepExtend_1 = __importDefault(require("./deepExtend"));
|
|
10
|
-
exports.deepExtend = deepExtend_1.default;
|
|
11
|
-
exports.default = {
|
|
12
|
-
deepEqual: deepEqual_1.default,
|
|
13
|
-
deepExtend: deepExtend_1.default
|
|
1
|
+
import deepEqual from './deepEqual';
|
|
2
|
+
import deepExtend from './deepExtend';
|
|
3
|
+
export { deepEqual, deepExtend };
|
|
4
|
+
export default {
|
|
5
|
+
deepEqual,
|
|
6
|
+
deepExtend
|
|
14
7
|
};
|
package/package.json
CHANGED
|
@@ -1,26 +1,39 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
2
|
+
"author": "Andrew Zolotukhin <andrew_zol@cleverbrush.com>",
|
|
3
|
+
"bugs": {
|
|
4
|
+
"url": "https://github.com/cleverbrush/framework/issues",
|
|
5
|
+
"email": "andrew_zol@cleverbrush.com"
|
|
6
|
+
},
|
|
7
|
+
"description": "Library for deep operations on objects like deep equal, deep extend, etc.",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://docs.cleverbrush.com/v1.0.0/modules/Deep_operations_on_objects.html",
|
|
4
12
|
"keywords": [
|
|
5
13
|
"deep operations on objects",
|
|
6
14
|
"deep equal",
|
|
7
|
-
"deep extend"
|
|
8
|
-
|
|
9
|
-
"author": "Andrew Zolotukhin <andrew_zol@cleverbrush.com>",
|
|
10
|
-
"license": "BSD",
|
|
11
|
-
"files": [
|
|
12
|
-
"*",
|
|
13
|
-
"dist/*"
|
|
15
|
+
"deep extend",
|
|
16
|
+
"cleverbrush"
|
|
14
17
|
],
|
|
18
|
+
"license": "BSD 3-Clause",
|
|
15
19
|
"main": "./dist/index.js",
|
|
16
|
-
"
|
|
20
|
+
"name": "@cleverbrush/deep",
|
|
21
|
+
"readme": "https://github.com/cleverbrush/framework/tree/master/libs/deep#readme",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "github:cleverbrush/framework"
|
|
25
|
+
},
|
|
17
26
|
"scripts": {
|
|
18
27
|
"watch": "tsc --watch",
|
|
19
28
|
"build": "tsc"
|
|
20
29
|
},
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
30
|
+
"typedoc": {
|
|
31
|
+
"entryPoint": "./src/index.ts",
|
|
32
|
+
"readmeFile": "./README.md",
|
|
33
|
+
"displayName": "Deep operations on objects",
|
|
34
|
+
"tsconfig": "./tsconfig.json"
|
|
24
35
|
},
|
|
25
|
-
"
|
|
36
|
+
"type": "module",
|
|
37
|
+
"types": "./dist/index.d.ts",
|
|
38
|
+
"version": "1.1.0"
|
|
26
39
|
}
|
package/src/deepEqual.test.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import deepEqual from './deepEqual.js';
|
|
2
|
-
|
|
3
|
-
test('deepEqual - 1', () => {
|
|
4
|
-
expect(deepEqual('a', 'a')).toEqual(true);
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
test('deepEqual - 2', () => {
|
|
8
|
-
expect(deepEqual('a', 'b')).toEqual(false);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
test('deepEqual - 3', () => {
|
|
12
|
-
expect(deepEqual({}, 'a')).toEqual(false);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
test('deepEqual - 4', () => {
|
|
16
|
-
expect(deepEqual({ a: 10 }, { a: 10 })).toEqual(true);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
test('deepEqual - 5', () => {
|
|
20
|
-
expect(deepEqual([], [])).toEqual(true);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
test('deepEqual - 6', () => {
|
|
24
|
-
expect(deepEqual([10], [])).toEqual(false);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
test('deepEqual - 7', () => {
|
|
28
|
-
expect(deepEqual([10], [10])).toEqual(true);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
test('deepEqual - 8', () => {
|
|
32
|
-
expect(deepEqual([10], [10, { b: 20 }])).toEqual(false);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
test('deepEqual - 9', () => {
|
|
36
|
-
expect(deepEqual([{ b: 20 }, 10], [10, { b: 20 }])).toEqual(false);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
test('deepEqual - 10', () => {
|
|
40
|
-
expect(
|
|
41
|
-
deepEqual([{ b: 20 }, 10], [10, { b: 20 }], {
|
|
42
|
-
disregardArrayOrder: true
|
|
43
|
-
})
|
|
44
|
-
).toEqual(true);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
test('deepEqual - 11', () => {
|
|
48
|
-
expect(
|
|
49
|
-
deepEqual(
|
|
50
|
-
[{ b: 20, c: { d: 'a', e: new Date(2022, 10, 1) } }, 10],
|
|
51
|
-
[10, { b: 20 }],
|
|
52
|
-
{
|
|
53
|
-
disregardArrayOrder: true
|
|
54
|
-
}
|
|
55
|
-
)
|
|
56
|
-
).toEqual(false);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
test('deepEqual - 12', () => {
|
|
60
|
-
expect(
|
|
61
|
-
deepEqual(
|
|
62
|
-
[{ b: 20, c: { d: 'a', e: new Date(2022, 10, 1) } }, 10],
|
|
63
|
-
[10, { b: 20, c: { e: new Date(2022, 10, 1), d: 'a' } }],
|
|
64
|
-
{
|
|
65
|
-
disregardArrayOrder: true
|
|
66
|
-
}
|
|
67
|
-
)
|
|
68
|
-
).toEqual(true);
|
|
69
|
-
});
|
package/src/deepEqual.ts
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { HashObject } from './hashObject.js';
|
|
2
|
-
|
|
3
|
-
const isBothNaN = function (v1, v2) {
|
|
4
|
-
return Number.isNaN(v1) && Number.isNaN(v2);
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
const deepEqual = function (
|
|
8
|
-
p1,
|
|
9
|
-
p2,
|
|
10
|
-
options?: { disregardArrayOrder?: boolean }
|
|
11
|
-
): boolean {
|
|
12
|
-
const cache = new Map();
|
|
13
|
-
|
|
14
|
-
const compare = function (o1, o2) {
|
|
15
|
-
const arraysAreIdentical = function (a1, a2) {
|
|
16
|
-
if (a1.length !== a2.length) return false;
|
|
17
|
-
if (a1.length === 0 && a2.length === 0) return true;
|
|
18
|
-
|
|
19
|
-
const c1 = options?.disregardArrayOrder
|
|
20
|
-
? a1
|
|
21
|
-
.map((t) => t)
|
|
22
|
-
.sort((l, r) => {
|
|
23
|
-
const hash1 = HashObject(l);
|
|
24
|
-
const hash2 = HashObject(r);
|
|
25
|
-
return hash1 < hash2 ? 1 : -1;
|
|
26
|
-
})
|
|
27
|
-
: a1.map((t) => t);
|
|
28
|
-
const c2 = options?.disregardArrayOrder
|
|
29
|
-
? a2
|
|
30
|
-
.map((t) => t)
|
|
31
|
-
.sort((l, r) => {
|
|
32
|
-
const hash1 = HashObject(l);
|
|
33
|
-
const hash2 = HashObject(r);
|
|
34
|
-
return hash1 < hash2 ? 1 : -1;
|
|
35
|
-
})
|
|
36
|
-
: a2.map((t) => t);
|
|
37
|
-
|
|
38
|
-
for (let i = 0; i < c1.length; i++) {
|
|
39
|
-
if (!compare(c1[i], c2[i])) return false;
|
|
40
|
-
}
|
|
41
|
-
return true;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
if (arguments.length !== 2) return false;
|
|
45
|
-
if (o1 === o2) return true;
|
|
46
|
-
if (typeof o1 !== typeof o2) return false;
|
|
47
|
-
if (isBothNaN(o1, o2)) return true;
|
|
48
|
-
|
|
49
|
-
if (
|
|
50
|
-
(Array.isArray(o1) && !Array.isArray(o2)) ||
|
|
51
|
-
(!Array.isArray(o1) && Array.isArray(o2))
|
|
52
|
-
) {
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
if (Array.isArray(o1) && Array.isArray(o2)) {
|
|
56
|
-
return arraysAreIdentical(o1, o2);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (typeof o1 === 'object') {
|
|
60
|
-
if (cache.get(o1) === true) {
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
cache.set(o1, true);
|
|
65
|
-
|
|
66
|
-
if (o1 instanceof Date && o2 instanceof Date) {
|
|
67
|
-
return (
|
|
68
|
-
!isNaN(o1 as any) &&
|
|
69
|
-
!isNaN(o2 as any) &&
|
|
70
|
-
o1.getTime() === o2.getTime()
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const keys1 = Object.keys(o1);
|
|
75
|
-
const keys2 = Object.keys(o2);
|
|
76
|
-
if (keys1.length != keys2.length) return false;
|
|
77
|
-
|
|
78
|
-
keys1.sort();
|
|
79
|
-
keys2.sort();
|
|
80
|
-
for (let i = 0; i < keys1.length; i++) {
|
|
81
|
-
if (keys1[i] !== keys2[i]) {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const v1 = o1[keys1[i]];
|
|
86
|
-
const v2 = o2[keys1[i]];
|
|
87
|
-
if (!compare(v1, v2)) return false;
|
|
88
|
-
}
|
|
89
|
-
return true;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return false;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
return compare(p1, p2);
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export default deepEqual;
|
package/src/deepExtend.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
export type CommonProps<T1, T2> = {
|
|
2
|
-
[k in keyof T1 & keyof T2]: T1[k] extends never
|
|
3
|
-
? never
|
|
4
|
-
: T2[k] extends never
|
|
5
|
-
? never
|
|
6
|
-
: T2[k];
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export type PropsInFirstOnly<T1, T2> = Omit<T1, keyof T2>;
|
|
10
|
-
|
|
11
|
-
export type MergeTwo<T1, T2> = PropsInFirstOnly<T1, T2> &
|
|
12
|
-
PropsInFirstOnly<T2, T1> & {
|
|
13
|
-
[k in keyof CommonProps<T1, T2>]: T1[k] extends Record<string, unknown>
|
|
14
|
-
? T2[k] extends Record<string, unknown>
|
|
15
|
-
? MergeTwo<T1[k], T2[k]>
|
|
16
|
-
: T2[k]
|
|
17
|
-
: T2[k];
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export type Merge<T extends unknown[]> = T['length'] extends 3
|
|
21
|
-
? MergeTwo<T[0], MergeTwo<T[1], T[2]>>
|
|
22
|
-
: T['length'] extends 2
|
|
23
|
-
? MergeTwo<T[0], T[1]>
|
|
24
|
-
: T['length'] extends 1
|
|
25
|
-
? T[0]
|
|
26
|
-
: T extends [...infer K, infer PL, infer L]
|
|
27
|
-
? Merge<[Merge<[...K]>, MergeTwo<PL, L>]>
|
|
28
|
-
: never;
|
|
29
|
-
|
|
30
|
-
const deepExtend: <T extends unknown[]>(...args: T) => Merge<T> = function () {
|
|
31
|
-
if (arguments.length === 0) return false;
|
|
32
|
-
if (arguments.length === 1) return arguments[0];
|
|
33
|
-
if (typeof arguments[0] !== 'object') return false;
|
|
34
|
-
|
|
35
|
-
const result = {};
|
|
36
|
-
|
|
37
|
-
const extendObject = function (o1, o2) {
|
|
38
|
-
if (o2 == null) return;
|
|
39
|
-
const keys = Object.keys(o2);
|
|
40
|
-
|
|
41
|
-
for (let i = 0; i < keys.length; i++) {
|
|
42
|
-
if (o2.hasOwnProperty(keys[i])) {
|
|
43
|
-
if (
|
|
44
|
-
!o1.hasOwnProperty(keys[i]) ||
|
|
45
|
-
!(
|
|
46
|
-
typeof o1[keys[i]] === 'object' &&
|
|
47
|
-
typeof o2[keys[i]] === 'object'
|
|
48
|
-
)
|
|
49
|
-
) {
|
|
50
|
-
o1[keys[i]] = o2[keys[i]];
|
|
51
|
-
} else {
|
|
52
|
-
if (o1[keys[i]] == null) {
|
|
53
|
-
o1[keys[i]] = o2[keys[i]];
|
|
54
|
-
} else {
|
|
55
|
-
extendObject(o1[keys[i]], o2[keys[i]]);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
for (let i = 0; i < arguments.length; i++) {
|
|
63
|
-
if (typeof arguments[i] === 'object' && arguments[i]) {
|
|
64
|
-
extendObject(result, arguments[i]);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return result;
|
|
69
|
-
};
|
|
70
|
-
export default deepExtend;
|
package/src/hashObject.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
const stringHash = (string, noType?) => {
|
|
2
|
-
let hashString = string;
|
|
3
|
-
if (!noType) {
|
|
4
|
-
hashString = `string${string}`;
|
|
5
|
-
}
|
|
6
|
-
let hash = 0;
|
|
7
|
-
for (let i = 0; i < hashString.length; i++) {
|
|
8
|
-
const character = hashString.charCodeAt(i);
|
|
9
|
-
hash = (hash << 5) - hash + character;
|
|
10
|
-
hash = hash & hash; // Convert to 32bit integer
|
|
11
|
-
}
|
|
12
|
-
return hash;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
function objectHash(obj, exclude) {
|
|
16
|
-
if (exclude.indexOf(obj) > -1) {
|
|
17
|
-
return undefined;
|
|
18
|
-
}
|
|
19
|
-
let hash = '';
|
|
20
|
-
const keys = Object.keys(obj).sort();
|
|
21
|
-
for (let index = 0; index < keys.length; index += 1) {
|
|
22
|
-
const key = keys[index];
|
|
23
|
-
const keyHash = hashFunc(key);
|
|
24
|
-
const attrHash = hashFunc(obj[key], exclude);
|
|
25
|
-
exclude.push(obj[key]);
|
|
26
|
-
hash += stringHash(`object${keyHash}${attrHash}`, true);
|
|
27
|
-
}
|
|
28
|
-
return stringHash(hash, true);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function HashObject(unkType, exclude?) {
|
|
32
|
-
let ex = exclude;
|
|
33
|
-
if (ex === undefined) {
|
|
34
|
-
ex = [];
|
|
35
|
-
}
|
|
36
|
-
if (!isNaN(unkType) && typeof unkType !== 'string') {
|
|
37
|
-
return unkType;
|
|
38
|
-
}
|
|
39
|
-
switch (typeof unkType) {
|
|
40
|
-
case 'object':
|
|
41
|
-
return objectHash(unkType, ex);
|
|
42
|
-
default:
|
|
43
|
-
return stringHash(String(unkType));
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const hashFunc = HashObject;
|
package/src/index.ts
DELETED
package/tsconfig.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"rootDir": "./src",
|
|
4
|
-
"outDir": "./dist",
|
|
5
|
-
"declaration": true,
|
|
6
|
-
"target": "esnext",
|
|
7
|
-
"module": "CommonJS",
|
|
8
|
-
"esModuleInterop": true,
|
|
9
|
-
"moduleResolution": "Node",
|
|
10
|
-
"allowSyntheticDefaultImports": true
|
|
11
|
-
},
|
|
12
|
-
"files": ["./src/index.ts"],
|
|
13
|
-
"watchOptions": {
|
|
14
|
-
"excludeDirectories": ["./dist"]
|
|
15
|
-
}
|
|
16
|
-
}
|