@alanszp/express 12.0.1 → 12.0.3

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.
Files changed (160) hide show
  1. package/package.json +6 -10
  2. package/.gitignore +0 -3
  3. package/.npmignore +0 -3
  4. package/node_modules/@jest/expect-utils/LICENSE +0 -21
  5. package/node_modules/@jest/expect-utils/README.md +0 -5
  6. package/node_modules/@jest/expect-utils/build/index.d.ts +0 -93
  7. package/node_modules/@jest/expect-utils/build/index.js +0 -37
  8. package/node_modules/@jest/expect-utils/build/jasmineUtils.js +0 -282
  9. package/node_modules/@jest/expect-utils/build/types.js +0 -1
  10. package/node_modules/@jest/expect-utils/build/utils.js +0 -457
  11. package/node_modules/@jest/expect-utils/package.json +0 -33
  12. package/node_modules/@jest/types/LICENSE +0 -21
  13. package/node_modules/@jest/types/README.md +0 -30
  14. package/node_modules/@jest/types/build/Circus.js +0 -1
  15. package/node_modules/@jest/types/build/Config.js +0 -1
  16. package/node_modules/@jest/types/build/Global.js +0 -1
  17. package/node_modules/@jest/types/build/TestResult.js +0 -1
  18. package/node_modules/@jest/types/build/Transform.js +0 -1
  19. package/node_modules/@jest/types/build/index.d.ts +0 -1166
  20. package/node_modules/@jest/types/build/index.js +0 -1
  21. package/node_modules/@jest/types/package.json +0 -38
  22. package/node_modules/@types/jest/LICENSE +0 -21
  23. package/node_modules/@types/jest/README.md +0 -17
  24. package/node_modules/@types/jest/index.d.ts +0 -1608
  25. package/node_modules/@types/jest/package.json +0 -159
  26. package/node_modules/@types/node/LICENSE +0 -21
  27. package/node_modules/@types/node/README.md +0 -15
  28. package/node_modules/@types/node/assert/strict.d.ts +0 -8
  29. package/node_modules/@types/node/assert.d.ts +0 -996
  30. package/node_modules/@types/node/async_hooks.d.ts +0 -539
  31. package/node_modules/@types/node/buffer.d.ts +0 -2362
  32. package/node_modules/@types/node/child_process.d.ts +0 -1540
  33. package/node_modules/@types/node/cluster.d.ts +0 -432
  34. package/node_modules/@types/node/console.d.ts +0 -415
  35. package/node_modules/@types/node/constants.d.ts +0 -19
  36. package/node_modules/@types/node/crypto.d.ts +0 -4487
  37. package/node_modules/@types/node/dgram.d.ts +0 -596
  38. package/node_modules/@types/node/diagnostics_channel.d.ts +0 -545
  39. package/node_modules/@types/node/dns/promises.d.ts +0 -425
  40. package/node_modules/@types/node/dns.d.ts +0 -809
  41. package/node_modules/@types/node/dom-events.d.ts +0 -122
  42. package/node_modules/@types/node/domain.d.ts +0 -170
  43. package/node_modules/@types/node/events.d.ts +0 -879
  44. package/node_modules/@types/node/fs/promises.d.ts +0 -1239
  45. package/node_modules/@types/node/fs.d.ts +0 -4311
  46. package/node_modules/@types/node/globals.d.ts +0 -411
  47. package/node_modules/@types/node/globals.global.d.ts +0 -1
  48. package/node_modules/@types/node/http.d.ts +0 -1887
  49. package/node_modules/@types/node/http2.d.ts +0 -2382
  50. package/node_modules/@types/node/https.d.ts +0 -550
  51. package/node_modules/@types/node/index.d.ts +0 -88
  52. package/node_modules/@types/node/inspector.d.ts +0 -2747
  53. package/node_modules/@types/node/module.d.ts +0 -315
  54. package/node_modules/@types/node/net.d.ts +0 -949
  55. package/node_modules/@types/node/os.d.ts +0 -478
  56. package/node_modules/@types/node/package.json +0 -229
  57. package/node_modules/@types/node/path.d.ts +0 -191
  58. package/node_modules/@types/node/perf_hooks.d.ts +0 -645
  59. package/node_modules/@types/node/process.d.ts +0 -1561
  60. package/node_modules/@types/node/punycode.d.ts +0 -117
  61. package/node_modules/@types/node/querystring.d.ts +0 -141
  62. package/node_modules/@types/node/readline/promises.d.ts +0 -150
  63. package/node_modules/@types/node/readline.d.ts +0 -539
  64. package/node_modules/@types/node/repl.d.ts +0 -430
  65. package/node_modules/@types/node/stream/consumers.d.ts +0 -12
  66. package/node_modules/@types/node/stream/promises.d.ts +0 -83
  67. package/node_modules/@types/node/stream/web.d.ts +0 -366
  68. package/node_modules/@types/node/stream.d.ts +0 -1701
  69. package/node_modules/@types/node/string_decoder.d.ts +0 -67
  70. package/node_modules/@types/node/test.d.ts +0 -1465
  71. package/node_modules/@types/node/timers/promises.d.ts +0 -93
  72. package/node_modules/@types/node/timers.d.ts +0 -240
  73. package/node_modules/@types/node/tls.d.ts +0 -1210
  74. package/node_modules/@types/node/trace_events.d.ts +0 -182
  75. package/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
  76. package/node_modules/@types/node/ts4.8/assert.d.ts +0 -996
  77. package/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -539
  78. package/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2362
  79. package/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1540
  80. package/node_modules/@types/node/ts4.8/cluster.d.ts +0 -432
  81. package/node_modules/@types/node/ts4.8/console.d.ts +0 -415
  82. package/node_modules/@types/node/ts4.8/constants.d.ts +0 -19
  83. package/node_modules/@types/node/ts4.8/crypto.d.ts +0 -4487
  84. package/node_modules/@types/node/ts4.8/dgram.d.ts +0 -596
  85. package/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -545
  86. package/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -425
  87. package/node_modules/@types/node/ts4.8/dns.d.ts +0 -809
  88. package/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -122
  89. package/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
  90. package/node_modules/@types/node/ts4.8/events.d.ts +0 -879
  91. package/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1239
  92. package/node_modules/@types/node/ts4.8/fs.d.ts +0 -4311
  93. package/node_modules/@types/node/ts4.8/globals.d.ts +0 -411
  94. package/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
  95. package/node_modules/@types/node/ts4.8/http.d.ts +0 -1887
  96. package/node_modules/@types/node/ts4.8/http2.d.ts +0 -2382
  97. package/node_modules/@types/node/ts4.8/https.d.ts +0 -550
  98. package/node_modules/@types/node/ts4.8/index.d.ts +0 -88
  99. package/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2747
  100. package/node_modules/@types/node/ts4.8/module.d.ts +0 -315
  101. package/node_modules/@types/node/ts4.8/net.d.ts +0 -949
  102. package/node_modules/@types/node/ts4.8/os.d.ts +0 -478
  103. package/node_modules/@types/node/ts4.8/path.d.ts +0 -191
  104. package/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -645
  105. package/node_modules/@types/node/ts4.8/process.d.ts +0 -1561
  106. package/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
  107. package/node_modules/@types/node/ts4.8/querystring.d.ts +0 -141
  108. package/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -150
  109. package/node_modules/@types/node/ts4.8/readline.d.ts +0 -539
  110. package/node_modules/@types/node/ts4.8/repl.d.ts +0 -430
  111. package/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
  112. package/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -83
  113. package/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -366
  114. package/node_modules/@types/node/ts4.8/stream.d.ts +0 -1701
  115. package/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
  116. package/node_modules/@types/node/ts4.8/test.d.ts +0 -1465
  117. package/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
  118. package/node_modules/@types/node/ts4.8/timers.d.ts +0 -240
  119. package/node_modules/@types/node/ts4.8/tls.d.ts +0 -1210
  120. package/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -182
  121. package/node_modules/@types/node/ts4.8/tty.d.ts +0 -208
  122. package/node_modules/@types/node/ts4.8/url.d.ts +0 -927
  123. package/node_modules/@types/node/ts4.8/util.d.ts +0 -2183
  124. package/node_modules/@types/node/ts4.8/v8.d.ts +0 -764
  125. package/node_modules/@types/node/ts4.8/vm.d.ts +0 -903
  126. package/node_modules/@types/node/ts4.8/wasi.d.ts +0 -179
  127. package/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -691
  128. package/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
  129. package/node_modules/@types/node/tty.d.ts +0 -208
  130. package/node_modules/@types/node/url.d.ts +0 -927
  131. package/node_modules/@types/node/util.d.ts +0 -2183
  132. package/node_modules/@types/node/v8.d.ts +0 -764
  133. package/node_modules/@types/node/vm.d.ts +0 -903
  134. package/node_modules/@types/node/wasi.d.ts +0 -179
  135. package/node_modules/@types/node/worker_threads.d.ts +0 -691
  136. package/node_modules/@types/node/zlib.d.ts +0 -517
  137. package/src/helpers/getIp.ts +0 -5
  138. package/src/helpers/getRequestLogger.ts +0 -6
  139. package/src/helpers/now.ts +0 -3
  140. package/src/helpers/renderErrorJson.ts +0 -29
  141. package/src/index.ts +0 -10
  142. package/src/middlewares/accessLogger.ts +0 -34
  143. package/src/middlewares/auditLog.ts +0 -52
  144. package/src/middlewares/authedForOrg.ts +0 -50
  145. package/src/middlewares/authenticateUser.test.ts +0 -403
  146. package/src/middlewares/authenticateUser.ts +0 -171
  147. package/src/middlewares/createContext.test.ts +0 -85
  148. package/src/middlewares/createContext.ts +0 -49
  149. package/src/middlewares/hasRoles.ts +0 -24
  150. package/src/middlewares/jsonBodyParser.ts +0 -22
  151. package/src/middlewares/returnInternalServerError.ts +0 -15
  152. package/src/middlewares/returnNotFound.ts +0 -11
  153. package/src/test/mocks/authOptionsMocks.ts +0 -35
  154. package/src/test/mocks/expressMocks.ts +0 -33
  155. package/src/test/mocks/jwtUserMocks.ts +0 -19
  156. package/src/test/setup.test.ts +0 -15
  157. package/src/test/setup.ts +0 -3
  158. package/src/types/AuthMethod.ts +0 -27
  159. package/src/types/GenericRequest.ts +0 -3
  160. package/src/types/custom.d.ts +0 -20
package/package.json CHANGED
@@ -1,13 +1,10 @@
1
1
  {
2
2
  "name": "@alanszp/express",
3
- "version": "12.0.1",
3
+ "version": "12.0.3",
4
4
  "description": "Alan's express utils and middlewares.",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
7
7
  "license": "MIT",
8
- "files": [
9
- "**/*"
10
- ],
11
8
  "publishConfig": {
12
9
  "access": "public"
13
10
  },
@@ -24,7 +21,6 @@
24
21
  "express": "^4.17.1"
25
22
  },
26
23
  "devDependencies": {
27
- "@alanszp/errors": "^12.0.1",
28
24
  "@types/body-parser": "^1.19.1",
29
25
  "@types/express": "^4.17.12",
30
26
  "@types/jest": "^28.1.8",
@@ -37,14 +33,14 @@
37
33
  "typescript": "^4.3.4"
38
34
  },
39
35
  "dependencies": {
40
- "@alanszp/audit": "^12.0.1",
41
- "@alanszp/jwt": "^12.0.0",
42
- "@alanszp/logger": "^12.0.0",
43
- "@alanszp/shared-context": "^12.0.1",
36
+ "@alanszp/audit": "^12.0.3",
37
+ "@alanszp/jwt": "^12.0.3",
38
+ "@alanszp/logger": "^12.0.3",
39
+ "@alanszp/shared-context": "^12.0.3",
44
40
  "@babel/core": "^7.23.9",
45
41
  "@paralleldrive/cuid2": "^2.2.2",
46
42
  "body-parser": "^1.20.2",
47
43
  "lodash": "^4.17.21"
48
44
  },
49
- "gitHead": "2320e554850aec120e0e8bc71c00a2197187af40"
45
+ "gitHead": "3917709ea888ae321c2ea6ab36dfc90597ccd35e"
50
46
  }
package/.gitignore DELETED
@@ -1,3 +0,0 @@
1
- node_modules
2
- *.log
3
- dist
package/.npmignore DELETED
@@ -1,3 +0,0 @@
1
- node_modules
2
- src
3
- *.log
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) Facebook, Inc. and its affiliates.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,5 +0,0 @@
1
- # `@jest/expect-utils`
2
-
3
- This module exports some utils for the `expect` function used in [Jest](https://jestjs.io/).
4
-
5
- You probably don't want to use this package directly. E.g. if you're writing [custom matcher](https://jestjs.io/docs/expect#expectextendmatchers), you should use the injected [`this.equals`](https://jestjs.io/docs/expect#thisequalsa-b).
@@ -1,93 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- export declare const arrayBufferEquality: (
8
- a: unknown,
9
- b: unknown,
10
- ) => boolean | undefined;
11
-
12
- export declare function emptyObject(obj: unknown): boolean;
13
-
14
- export declare const equals: EqualsFunction;
15
-
16
- export declare type EqualsFunction = (
17
- a: unknown,
18
- b: unknown,
19
- customTesters?: Array<Tester>,
20
- strictCheck?: boolean,
21
- ) => boolean;
22
-
23
- export declare const getObjectSubset: (
24
- object: any,
25
- subset: any,
26
- seenReferences?: WeakMap<object, boolean>,
27
- ) => any;
28
-
29
- /**
30
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
31
- *
32
- * This source code is licensed under the MIT license found in the
33
- * LICENSE file in the root directory of this source tree.
34
- *
35
- */
36
- declare type GetPath = {
37
- hasEndProp?: boolean;
38
- endPropIsDefined?: boolean;
39
- lastTraversedObject: unknown;
40
- traversedPath: Array<string>;
41
- value?: unknown;
42
- };
43
-
44
- export declare const getPath: (
45
- object: Record<string, any>,
46
- propertyPath: string | Array<string>,
47
- ) => GetPath;
48
-
49
- export declare function isA(typeName: string, value: unknown): boolean;
50
-
51
- export declare const isError: (value: unknown) => value is Error;
52
-
53
- export declare const isOneline: (
54
- expected: unknown,
55
- received: unknown,
56
- ) => boolean;
57
-
58
- export declare const iterableEquality: (
59
- a: any,
60
- b: any,
61
- aStack?: Array<any>,
62
- bStack?: Array<any>,
63
- ) => boolean | undefined;
64
-
65
- export declare const partition: <T>(
66
- items: T[],
67
- predicate: (arg: T) => boolean,
68
- ) => [T[], T[]];
69
-
70
- export declare const pathAsArray: (propertyPath: string) => Array<any>;
71
-
72
- export declare const sparseArrayEquality: (
73
- a: unknown,
74
- b: unknown,
75
- ) => boolean | undefined;
76
-
77
- export declare const subsetEquality: (
78
- object: unknown,
79
- subset: unknown,
80
- ) => boolean | undefined;
81
-
82
- /**
83
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
84
- *
85
- * This source code is licensed under the MIT license found in the
86
- * LICENSE file in the root directory of this source tree.
87
- *
88
- */
89
- export declare type Tester = (a: any, b: any) => boolean | undefined;
90
-
91
- export declare const typeEquality: (a: any, b: any) => boolean | undefined;
92
-
93
- export {};
@@ -1,37 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true
5
- });
6
- var _exportNames = {
7
- equals: true,
8
- isA: true
9
- };
10
- Object.defineProperty(exports, 'equals', {
11
- enumerable: true,
12
- get: function () {
13
- return _jasmineUtils.equals;
14
- }
15
- });
16
- Object.defineProperty(exports, 'isA', {
17
- enumerable: true,
18
- get: function () {
19
- return _jasmineUtils.isA;
20
- }
21
- });
22
-
23
- var _jasmineUtils = require('./jasmineUtils');
24
-
25
- var _utils = require('./utils');
26
-
27
- Object.keys(_utils).forEach(function (key) {
28
- if (key === 'default' || key === '__esModule') return;
29
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
30
- if (key in exports && exports[key] === _utils[key]) return;
31
- Object.defineProperty(exports, key, {
32
- enumerable: true,
33
- get: function () {
34
- return _utils[key];
35
- }
36
- });
37
- });
@@ -1,282 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true
5
- });
6
- exports.equals = void 0;
7
- exports.isA = isA;
8
- exports.isImmutableList = isImmutableList;
9
- exports.isImmutableOrderedKeyed = isImmutableOrderedKeyed;
10
- exports.isImmutableOrderedSet = isImmutableOrderedSet;
11
- exports.isImmutableUnorderedKeyed = isImmutableUnorderedKeyed;
12
- exports.isImmutableUnorderedSet = isImmutableUnorderedSet;
13
-
14
- /*
15
- Copyright (c) 2008-2016 Pivotal Labs
16
-
17
- Permission is hereby granted, free of charge, to any person obtaining
18
- a copy of this software and associated documentation files (the
19
- "Software"), to deal in the Software without restriction, including
20
- without limitation the rights to use, copy, modify, merge, publish,
21
- distribute, sublicense, and/or sell copies of the Software, and to
22
- permit persons to whom the Software is furnished to do so, subject to
23
- the following conditions:
24
-
25
- The above copyright notice and this permission notice shall be
26
- included in all copies or substantial portions of the Software.
27
-
28
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35
-
36
- */
37
-
38
- /* eslint-disable */
39
- // Extracted out of jasmine 2.5.2
40
- const equals = (a, b, customTesters, strictCheck) => {
41
- customTesters = customTesters || [];
42
- return eq(a, b, [], [], customTesters, strictCheck);
43
- };
44
-
45
- exports.equals = equals;
46
-
47
- function isAsymmetric(obj) {
48
- return !!obj && isA('Function', obj.asymmetricMatch);
49
- }
50
-
51
- function asymmetricMatch(a, b) {
52
- var asymmetricA = isAsymmetric(a),
53
- asymmetricB = isAsymmetric(b);
54
-
55
- if (asymmetricA && asymmetricB) {
56
- return undefined;
57
- }
58
-
59
- if (asymmetricA) {
60
- return a.asymmetricMatch(b);
61
- }
62
-
63
- if (asymmetricB) {
64
- return b.asymmetricMatch(a);
65
- }
66
- } // Equality function lovingly adapted from isEqual in
67
- // [Underscore](http://underscorejs.org)
68
-
69
- function eq(a, b, aStack, bStack, customTesters, strictCheck) {
70
- var result = true;
71
- var asymmetricResult = asymmetricMatch(a, b);
72
-
73
- if (asymmetricResult !== undefined) {
74
- return asymmetricResult;
75
- }
76
-
77
- for (var i = 0; i < customTesters.length; i++) {
78
- var customTesterResult = customTesters[i](a, b);
79
-
80
- if (customTesterResult !== undefined) {
81
- return customTesterResult;
82
- }
83
- }
84
-
85
- if (a instanceof Error && b instanceof Error) {
86
- return a.message == b.message;
87
- }
88
-
89
- if (Object.is(a, b)) {
90
- return true;
91
- } // A strict comparison is necessary because `null == undefined`.
92
-
93
- if (a === null || b === null) {
94
- return a === b;
95
- }
96
-
97
- var className = Object.prototype.toString.call(a);
98
-
99
- if (className != Object.prototype.toString.call(b)) {
100
- return false;
101
- }
102
-
103
- switch (className) {
104
- case '[object Boolean]':
105
- case '[object String]':
106
- case '[object Number]':
107
- if (typeof a !== typeof b) {
108
- // One is a primitive, one a `new Primitive()`
109
- return false;
110
- } else if (typeof a !== 'object' && typeof b !== 'object') {
111
- // both are proper primitives
112
- return Object.is(a, b);
113
- } else {
114
- // both are `new Primitive()`s
115
- return Object.is(a.valueOf(), b.valueOf());
116
- }
117
-
118
- case '[object Date]':
119
- // Coerce dates to numeric primitive values. Dates are compared by their
120
- // millisecond representations. Note that invalid dates with millisecond representations
121
- // of `NaN` are not equivalent.
122
- return +a == +b;
123
- // RegExps are compared by their source patterns and flags.
124
-
125
- case '[object RegExp]':
126
- return a.source === b.source && a.flags === b.flags;
127
- }
128
-
129
- if (typeof a !== 'object' || typeof b !== 'object') {
130
- return false;
131
- } // Use DOM3 method isEqualNode (IE>=9)
132
-
133
- if (isDomNode(a) && isDomNode(b)) {
134
- return a.isEqualNode(b);
135
- } // Used to detect circular references.
136
-
137
- var length = aStack.length;
138
-
139
- while (length--) {
140
- // Linear search. Performance is inversely proportional to the number of
141
- // unique nested structures.
142
- // circular references at same depth are equal
143
- // circular reference is not equal to non-circular one
144
- if (aStack[length] === a) {
145
- return bStack[length] === b;
146
- } else if (bStack[length] === b) {
147
- return false;
148
- }
149
- } // Add the first object to the stack of traversed objects.
150
-
151
- aStack.push(a);
152
- bStack.push(b); // Recursively compare objects and arrays.
153
- // Compare array lengths to determine if a deep comparison is necessary.
154
-
155
- if (strictCheck && className == '[object Array]' && a.length !== b.length) {
156
- return false;
157
- } // Deep compare objects.
158
-
159
- var aKeys = keys(a, hasKey),
160
- key;
161
- var bKeys = keys(b, hasKey); // Add keys corresponding to asymmetric matchers if they miss in non strict check mode
162
-
163
- if (!strictCheck) {
164
- for (var index = 0; index !== bKeys.length; ++index) {
165
- key = bKeys[index];
166
-
167
- if ((isAsymmetric(b[key]) || b[key] === undefined) && !hasKey(a, key)) {
168
- aKeys.push(key);
169
- }
170
- }
171
-
172
- for (var index = 0; index !== aKeys.length; ++index) {
173
- key = aKeys[index];
174
-
175
- if ((isAsymmetric(a[key]) || a[key] === undefined) && !hasKey(b, key)) {
176
- bKeys.push(key);
177
- }
178
- }
179
- } // Ensure that both objects contain the same number of properties before comparing deep equality.
180
-
181
- var size = aKeys.length;
182
-
183
- if (bKeys.length !== size) {
184
- return false;
185
- }
186
-
187
- while (size--) {
188
- key = aKeys[size]; // Deep compare each member
189
-
190
- if (strictCheck)
191
- result =
192
- hasKey(b, key) &&
193
- eq(a[key], b[key], aStack, bStack, customTesters, strictCheck);
194
- else
195
- result =
196
- (hasKey(b, key) || isAsymmetric(a[key]) || a[key] === undefined) &&
197
- eq(a[key], b[key], aStack, bStack, customTesters, strictCheck);
198
-
199
- if (!result) {
200
- return false;
201
- }
202
- } // Remove the first object from the stack of traversed objects.
203
-
204
- aStack.pop();
205
- bStack.pop();
206
- return result;
207
- }
208
-
209
- function keys(obj, hasKey) {
210
- var keys = [];
211
-
212
- for (var key in obj) {
213
- if (hasKey(obj, key)) {
214
- keys.push(key);
215
- }
216
- }
217
-
218
- return keys.concat(
219
- Object.getOwnPropertySymbols(obj).filter(
220
- symbol => Object.getOwnPropertyDescriptor(obj, symbol).enumerable
221
- )
222
- );
223
- }
224
-
225
- function hasKey(obj, key) {
226
- return Object.prototype.hasOwnProperty.call(obj, key);
227
- }
228
-
229
- function isA(typeName, value) {
230
- return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
231
- }
232
-
233
- function isDomNode(obj) {
234
- return (
235
- obj !== null &&
236
- typeof obj === 'object' &&
237
- typeof obj.nodeType === 'number' &&
238
- typeof obj.nodeName === 'string' &&
239
- typeof obj.isEqualNode === 'function'
240
- );
241
- } // SENTINEL constants are from https://github.com/immutable-js/immutable-js/tree/main/src/predicates
242
-
243
- const IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';
244
- const IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';
245
- const IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';
246
- const IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';
247
-
248
- function isImmutableUnorderedKeyed(maybeKeyed) {
249
- return !!(
250
- maybeKeyed &&
251
- maybeKeyed[IS_KEYED_SENTINEL] &&
252
- !maybeKeyed[IS_ORDERED_SENTINEL]
253
- );
254
- }
255
-
256
- function isImmutableUnorderedSet(maybeSet) {
257
- return !!(
258
- maybeSet &&
259
- maybeSet[IS_SET_SENTINEL] &&
260
- !maybeSet[IS_ORDERED_SENTINEL]
261
- );
262
- }
263
-
264
- function isImmutableList(maybeList) {
265
- return !!(maybeList && maybeList[IS_LIST_SENTINEL]);
266
- }
267
-
268
- function isImmutableOrderedKeyed(maybeKeyed) {
269
- return !!(
270
- maybeKeyed &&
271
- maybeKeyed[IS_KEYED_SENTINEL] &&
272
- maybeKeyed[IS_ORDERED_SENTINEL]
273
- );
274
- }
275
-
276
- function isImmutableOrderedSet(maybeSet) {
277
- return !!(
278
- maybeSet &&
279
- maybeSet[IS_SET_SENTINEL] &&
280
- maybeSet[IS_ORDERED_SENTINEL]
281
- );
282
- }
@@ -1 +0,0 @@
1
- 'use strict';