likec4 1.59.4 → 1.61.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 +2 -0
- package/__app__/codegen/react.mjs +4 -10
- package/__app__/codegen/webcomponent.mjs +6 -131
- package/__app__/index.html +15 -15
- package/__app__/src/aichat/index.mjs +11 -7
- package/__app__/src/chunks/AIChat.mjs +1355 -739
- package/__app__/src/chunks/ErrorComponent.mjs +444 -0
- package/__app__/src/chunks/Header.mjs +269 -0
- package/__app__/src/chunks/ViewReact.mjs +438 -0
- package/__app__/src/chunks/find.mjs +38 -0
- package/__app__/src/chunks/hooks.mjs +158 -472
- package/__app__/src/chunks/libs/@tabler/icons-react.mjs +340 -0
- package/__app__/src/chunks/libs/@tanstack-ai.mjs +11841 -1417
- package/__app__/src/chunks/libs/@tanstack.mjs +5110 -2404
- package/__app__/src/chunks/libs/fast-equals.mjs +507 -214
- package/__app__/src/chunks/libs/html-to-image.mjs +613 -0
- package/__app__/src/chunks/libs/nanostores.mjs +170 -0
- package/__app__/src/chunks/libs/react-resizable-panels.mjs +2792 -0
- package/__app__/src/chunks/react.mjs +22 -0
- package/__app__/src/chunks/rolldown-runtime.mjs +16 -29
- package/__app__/src/chunks/router.mjs +106 -0
- package/__app__/src/chunks/scope.mjs +106 -0
- package/__app__/src/chunks/searchParams.mjs +29 -0
- package/__app__/src/chunks/single-index.mjs +465 -0
- package/__app__/src/chunks/styled-system.mjs +1826 -2528
- package/__app__/src/chunks/useAsync.mjs +69 -0
- package/__app__/src/chunks/useSyncedRef.mjs +16 -0
- package/__app__/src/components/ColorSchemeToggle.mjs +124 -0
- package/__app__/src/components/CopyToClipboard.mjs +53 -0
- package/__app__/src/components/ErrorComponent.mjs +1 -0
- package/__app__/src/components/NavigationPanel.mjs +63 -0
- package/__app__/src/components/NotFound.mjs +155 -0
- package/__app__/src/components/ViewOutlet.mjs +9 -0
- package/__app__/src/components/model-diff/CompareModelProvider.mjs +44 -0
- package/__app__/src/components/model-diff/ModelDiffPanel.mjs +179 -0
- package/__app__/src/components/model-diff/compare-model.mjs +76 -0
- package/__app__/src/components/model-diff/state.mjs +45 -0
- package/__app__/src/components/search/OverviewSearch.mjs +92 -0
- package/__app__/src/components/search/OverviewSearchAdapter.mjs +94 -0
- package/__app__/src/components/sidebar/DiagramTree.css.mjs +48 -0
- package/__app__/src/components/sidebar/DiagramsTree.mjs +304 -0
- package/__app__/src/components/sidebar/Drawer.mjs +178 -0
- package/__app__/src/components/sidebar/SidebarBurger.mjs +28 -0
- package/__app__/src/components/sidebar/data.mjs +94 -0
- package/__app__/src/components/sidebar/state.mjs +16 -0
- package/__app__/src/components/view-page/Header.mjs +1 -0
- package/__app__/src/components/view-page/SelectProject.mjs +258 -0
- package/__app__/src/components/view-page/ShareModal.mjs +111 -0
- package/__app__/src/components/view-page/share-modal/AlertLocalhost.mjs +31 -0
- package/__app__/src/components/view-page/share-modal/CopyButtonChild.mjs +36 -0
- package/__app__/src/components/view-page/share-modal/EmbedPanel.mjs +100 -0
- package/__app__/src/components/view-page/share-modal/WebcomponentsPanel.mjs +264 -0
- package/__app__/src/components/view-page/state.mjs +17 -0
- package/__app__/src/context/LikeC4CustomizationContext.mjs +26 -0
- package/__app__/src/context/LikeC4IconRendererContext.mjs +29 -0
- package/__app__/src/context/LikeC4ModelContext.mjs +34 -0
- package/__app__/src/context/LikeC4ProjectsContext.mjs +40 -0
- package/__app__/src/context/ModelDiffsContext.mjs +33 -0
- package/__app__/src/context/safeCtx.mjs +14 -0
- package/__app__/src/fonts.css +112 -1
- package/__app__/src/hooks.mjs +1 -0
- package/__app__/src/main.mjs +6 -29151
- package/__app__/src/pages/EmbedPage.mjs +93 -0
- package/__app__/src/pages/ExportPage.mjs +691 -0
- package/__app__/src/pages/ProjectsOverview.mjs +23 -0
- package/__app__/src/pages/ViewAsD2.mjs +105 -0
- package/__app__/src/pages/ViewAsDot.mjs +65 -0
- package/__app__/src/pages/ViewAsMmd.mjs +109 -0
- package/__app__/src/pages/ViewAsPuml.mjs +105 -0
- package/__app__/src/pages/ViewEditor.mjs +220 -0
- package/__app__/src/pages/ViewReact.mjs +1 -0
- package/__app__/src/pages/export-layout.mjs +95 -0
- package/__app__/src/pages/export-page-params.mjs +9 -0
- package/__app__/src/pages/styles.css.mjs +23 -0
- package/__app__/src/routeTree.gen.mjs +105 -0
- package/__app__/src/router.mjs +1 -0
- package/__app__/src/routes/__root.mjs +65 -0
- package/__app__/src/routes/index.css.mjs +29 -0
- package/__app__/src/routes/index.mjs +32 -0
- package/__app__/src/routes/project._projectId/-components.mjs +100 -0
- package/__app__/src/routes/project._projectId/embed._viewId.mjs +5 -0
- package/__app__/src/routes/project._projectId/export._viewId.mjs +24 -0
- package/__app__/src/routes/project._projectId/index.mjs +14 -0
- package/__app__/src/routes/project._projectId/route.mjs +93 -0
- package/__app__/src/routes/project._projectId/view._viewId.d2.mjs +34 -0
- package/__app__/src/routes/project._projectId/view._viewId.dot.mjs +41 -0
- package/__app__/src/routes/project._projectId/view._viewId.index.mjs +7 -0
- package/__app__/src/routes/project._projectId/view._viewId.mjs +23 -0
- package/__app__/src/routes/project._projectId/view._viewId.mmd.mjs +39 -0
- package/__app__/src/routes/project._projectId/view._viewId.puml.mjs +34 -0
- package/__app__/src/routes/projects.mjs +36 -0
- package/__app__/src/routes/single-index.mjs +1 -0
- package/__app__/src/routes/webcomponent._.mjs +94 -0
- package/__app__/src/style.css +18497 -1
- package/config/schema.json +146 -97
- package/dist/app/render-view-client.css +1 -1
- package/dist/app/render-view-client.js +394 -238
- package/dist/chunks/enableServer.mjs +1 -1
- package/dist/chunks/filenames.mjs +25 -17
- package/dist/chunks/generate-likec4.mjs +5 -0
- package/dist/chunks/index.d.mts +255 -194
- package/dist/chunks/index2.d.mts +8246 -3610
- package/dist/chunks/libs/@chenglou/pretext.mjs +9 -0
- package/dist/chunks/libs/@chevrotain/gast.mjs +27 -1
- package/dist/chunks/libs/@chevrotain/regexp-to-ast.mjs +81 -9
- package/dist/chunks/libs/@logtape/logtape.mjs +5 -4
- package/dist/chunks/libs/@lume/kiwi.mjs +1 -1
- package/dist/chunks/libs/@ts-graphviz/common.d.mts +2 -4
- package/dist/chunks/libs/@ts-graphviz/core.mjs +1 -1
- package/dist/chunks/libs/birpc.mjs +1 -1
- package/dist/chunks/libs/chevrotain-allstar.mjs +2 -2
- package/dist/chunks/libs/chevrotain.mjs +88 -36
- package/dist/chunks/libs/clone.mjs +1 -0
- package/dist/chunks/libs/eventemitter3.mjs +1 -1
- package/dist/chunks/libs/fast-equals.mjs +1 -0
- package/dist/chunks/libs/fontkit.mjs +1 -0
- package/dist/chunks/libs/json5.mjs +4 -4
- package/dist/chunks/libs/langium.d.mts +6707 -6715
- package/dist/chunks/libs/langium.mjs +16 -24
- package/dist/chunks/libs/merge-error-cause.mjs +1 -1
- package/dist/chunks/libs/p-limit.mjs +1 -0
- package/dist/chunks/libs/p-queue.mjs +1 -1
- package/dist/chunks/libs/package-manager-detector.mjs +1 -1
- package/dist/chunks/libs/pako.mjs +1 -1
- package/dist/chunks/libs/pathe.mjs +1 -1
- package/dist/chunks/libs/pretty-ms.mjs +1 -1
- package/dist/chunks/libs/remeda.mjs +1 -1
- package/dist/chunks/libs/ufo.mjs +1 -1
- package/dist/chunks/libs/unstorage.mjs +1 -1
- package/dist/chunks/libs/which.mjs +1 -1
- package/dist/chunks/node.mjs +111 -77
- package/dist/chunks/rolldown-runtime.mjs +1 -1
- package/dist/chunks/sequence-view.mjs +1 -1
- package/dist/chunks/vite-plugin.mjs +185 -166
- package/dist/cli/index.mjs +254 -1306
- package/dist/config/index.d.mts +66 -5
- package/dist/config/index.mjs +1 -1
- package/dist/generators/likec4.d.mts +6530 -0
- package/dist/generators/likec4.mjs +1 -0
- package/dist/index.d.mts +2 -4
- package/dist/model/index.d.mts +0 -7
- package/dist/vite-plugin/index.d.mts +83 -58
- package/dist/vite-plugin/index.mjs +1 -1
- package/dist/vite-plugin/internal/chunks/rolldown-runtime.mjs +8 -0
- package/dist/vite-plugin/internal/index.d.mts +92 -17
- package/dist/vite-plugin/internal/index.mjs +225 -126
- package/generators/likec4/package.json +4 -0
- package/package.json +134 -122
- package/react/index.d.mts +7496 -26659
- package/react/index.mjs +533 -63936
- package/react/rolldown-runtime-CfRud99p.js +1 -0
- package/skills/likec4-dsl/SKILL.md +474 -0
- package/skills/likec4-dsl/evals/evals-public.json +207 -0
- package/skills/likec4-dsl/evals/grading-spec.json +603 -0
- package/skills/likec4-dsl/references/bridge-leanix-drawio.md +42 -0
- package/skills/likec4-dsl/references/cli.md +168 -0
- package/skills/likec4-dsl/references/configuration.md +266 -0
- package/skills/likec4-dsl/references/deployment.md +160 -0
- package/skills/likec4-dsl/references/diffs.md +52 -0
- package/skills/likec4-dsl/references/dynamic-views.md +455 -0
- package/skills/likec4-dsl/references/examples.md +370 -0
- package/skills/likec4-dsl/references/identifier-validity.md +90 -0
- package/skills/likec4-dsl/references/include-predicates-wildcards.md +180 -0
- package/skills/likec4-dsl/references/model.md +182 -0
- package/skills/likec4-dsl/references/predicates.md +123 -0
- package/skills/likec4-dsl/references/relationships-bidirectional.md +176 -0
- package/skills/likec4-dsl/references/specification.md +79 -0
- package/skills/likec4-dsl/references/style-tokens-colors.md +150 -0
- package/skills/likec4-dsl/references/troubleshooting.md +101 -0
- package/skills/likec4-dsl/references/views.md +329 -0
- package/vite-plugin-modules.d.ts +126 -51
- package/__app__/src/chunks/LikeC4Styles.mjs +0 -2306
- package/__app__/src/chunks/ProjectsOverview.mjs +0 -537
- package/__app__/src/chunks/es.mjs +0 -439
- package/__app__/src/chunks/libs/@floating-ui.mjs +0 -2532
- package/__app__/src/chunks/libs/@mantine.mjs +0 -13868
- package/__app__/src/chunks/libs/@xstate/react.mjs +0 -2015
- package/__app__/src/chunks/libs/@xyflow/react.mjs +0 -5367
- package/__app__/src/chunks/libs/bezier-js.mjs +0 -1007
- package/__app__/src/chunks/libs/d3.mjs +0 -2817
- package/__app__/src/chunks/libs/framer.mjs +0 -5926
- package/__app__/src/chunks/libs/zod.mjs +0 -3176
- package/dist/chunks/libs/@chevrotain/types.d.mts +0 -108
- package/dist/chunks/libs/picomatch.mjs +0 -1
- package/dist/chunks/libs/zod.d.mts +0 -3840
- package/dist/chunks/libs/zod.mjs +0 -65
|
@@ -1,281 +1,574 @@
|
|
|
1
1
|
import "../rolldown-runtime.mjs";
|
|
2
|
-
|
|
3
|
-
var { getOwnPropertyNames
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
// ../../node_modules/.pnpm/fast-equals@6.2.2/node_modules/fast-equals/dist/es/index.mjs
|
|
3
|
+
var { getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols } = Object;
|
|
4
|
+
var { hasOwnProperty, toString: toString$1 } = Object.prototype;
|
|
5
|
+
var OBJECT_TAG = "[object Object]";
|
|
6
|
+
/**
|
|
7
|
+
* Whether the own properties from `end` onward are equal with strict property checking, where the
|
|
8
|
+
* caller has already verified that both objects have the same number of own properties.
|
|
9
|
+
*/
|
|
10
|
+
function areStrictPropertiesEqual(a, b, state, properties, end) {
|
|
11
|
+
let index = properties.length;
|
|
12
|
+
let property;
|
|
13
|
+
let descriptorA;
|
|
14
|
+
let descriptorB;
|
|
15
|
+
while (index-- > end) {
|
|
16
|
+
property = properties[index];
|
|
17
|
+
if (!isReactProperty(a, b, property) && (!hasOwn(b, property) || !state.equals(a[property], b[property], property, property, a, b, state))) return false;
|
|
18
|
+
descriptorA = getOwnPropertyDescriptor(a, property);
|
|
19
|
+
descriptorB = getOwnPropertyDescriptor(b, property);
|
|
20
|
+
if ((descriptorA || descriptorB) && (!descriptorA || !descriptorB || descriptorA.configurable !== descriptorB.configurable || descriptorA.enumerable !== descriptorB.enumerable || descriptorA.writable !== descriptorB.writable)) return false;
|
|
21
|
+
}
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Combine two comparators into a single comparators.
|
|
26
|
+
*/
|
|
27
|
+
function combineComparators(comparatorA, comparatorB) {
|
|
28
|
+
return function isEqual(a, b, state) {
|
|
29
|
+
return comparatorA(a, b, state) && comparatorB(a, b, state);
|
|
7
30
|
};
|
|
8
31
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Wrap the provided `areItemsEqual` method to manage the circular state, allowing
|
|
34
|
+
* for circular references to be safely included in the comparison without creating
|
|
35
|
+
* stack overflows.
|
|
36
|
+
*/
|
|
37
|
+
function createIsCircular(areItemsEqual) {
|
|
38
|
+
return function isCircular(a, b, state) {
|
|
39
|
+
if (!a || !b || typeof a !== "object" || typeof b !== "object") return areItemsEqual(a, b, state);
|
|
40
|
+
const { cache } = state;
|
|
41
|
+
const cachedA = cache.get(a);
|
|
42
|
+
const cachedB = cache.get(b);
|
|
43
|
+
if (cachedA && cachedB) return cachedA === b && cachedB === a;
|
|
44
|
+
cache.set(a, b);
|
|
45
|
+
cache.set(b, a);
|
|
46
|
+
const result = areItemsEqual(a, b, state);
|
|
47
|
+
cache.delete(a);
|
|
48
|
+
cache.delete(b);
|
|
49
|
+
return result;
|
|
17
50
|
};
|
|
18
51
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Get the properties to strictly examine, which include both own properties that are
|
|
54
|
+
* not enumerable and symbol properties.
|
|
55
|
+
*/
|
|
56
|
+
function getStrictProperties(object) {
|
|
57
|
+
const symbols = getOwnPropertySymbols(object);
|
|
58
|
+
return symbols.length ? getOwnPropertyNames(object).concat(symbols) : getOwnPropertyNames(object);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Identify the element type of TypedArrays across realms and subclasses.
|
|
62
|
+
*/
|
|
63
|
+
var getTypedArrayTag = getOwnPropertyDescriptor(Object.getPrototypeOf(Int8Array.prototype), Symbol.toStringTag).get;
|
|
64
|
+
/**
|
|
65
|
+
* Whether the object contains the property passed as an own property.
|
|
66
|
+
*/
|
|
67
|
+
var hasOwn = Object.hasOwn || ((object, property) => hasOwnProperty.call(object, property));
|
|
68
|
+
/**
|
|
69
|
+
* Whether a null-prototype object is being compared with a plain object. Only one side can be
|
|
70
|
+
* null-prototype when the constructors differ. The other side must be a plain object by
|
|
71
|
+
* constructor, or by tag when it comes from another realm.
|
|
72
|
+
*/
|
|
73
|
+
function isNullPrototypeComparable(a, b) {
|
|
74
|
+
const aConstructor = a.constructor;
|
|
75
|
+
const bConstructor = b.constructor;
|
|
76
|
+
if (aConstructor == null) return bConstructor === Object || toString$1.call(b) === OBJECT_TAG;
|
|
77
|
+
if (bConstructor == null) return aConstructor === Object || toString$1.call(a) === OBJECT_TAG;
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Whether the property passed is a property specific to React/Preact elements. These are ignored in comparison, as they
|
|
82
|
+
* are deeply circular and will return frequent false negatives for the comparison that matters, which is often the
|
|
83
|
+
* React element's aspects (`props`, `type`, etc.).
|
|
84
|
+
*/
|
|
85
|
+
function isReactProperty(a, b, property) {
|
|
86
|
+
return (property === "_owner" || property === "__o" || property === "__v") && !!(a.$$typeof || b.$$typeof);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Reorder a serialized query string so that params holding the same pairs compare as equal
|
|
90
|
+
* regardless of the order they appear in.
|
|
91
|
+
*
|
|
92
|
+
* @note
|
|
93
|
+
* The serializer percent-encodes `&` and `=` wherever they appear inside a name or a value, so
|
|
94
|
+
* splitting on `&` recovers exactly the pairs and nothing else.
|
|
95
|
+
*/
|
|
96
|
+
function sortSearchParams(serialized) {
|
|
97
|
+
return serialized.split("&").sort().join("&");
|
|
22
98
|
}
|
|
23
|
-
|
|
24
|
-
|
|
99
|
+
/**
|
|
100
|
+
* Above this many keys, out-of-position keys are checked with `propertyIsEnumerable` rather than by
|
|
101
|
+
* scanning the other object's keys. Measured in V8: scanning wins up to 50 keys and loses from 100.
|
|
102
|
+
*/
|
|
103
|
+
var MAX_SCANNED_PROPERTIES = 64;
|
|
104
|
+
var { keys } = Object;
|
|
105
|
+
var { propertyIsEnumerable } = Object.prototype;
|
|
106
|
+
/**
|
|
107
|
+
* Whether the values passed are equal based on a [SameValue](https://262.ecma-international.org/7.0/#sec-samevalue) basis.
|
|
108
|
+
* Simplified, this maps to if the two values are referentially equal to one another (`a === b`) or both are `NaN`.
|
|
109
|
+
*
|
|
110
|
+
* @note
|
|
111
|
+
* When available in the environment, this is just a re-export of the global
|
|
112
|
+
* [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is) method.
|
|
113
|
+
*/
|
|
114
|
+
var sameValueEqual = Object.is || function sameValueEqual(a, b) {
|
|
115
|
+
return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;
|
|
25
116
|
};
|
|
26
|
-
|
|
27
|
-
|
|
117
|
+
/**
|
|
118
|
+
* Whether the values passed are equal based on a
|
|
119
|
+
* [Strict Equality Comparison](https://262.ecma-international.org/7.0/#sec-strict-equality-comparison) basis.
|
|
120
|
+
* Simplified, this maps to if the two values are referentially equal to one another (`a === b`).
|
|
121
|
+
*
|
|
122
|
+
* @note
|
|
123
|
+
* This is mainly available as a convenience function, such as being a default when a function to determine equality between
|
|
124
|
+
* two objects is used.
|
|
125
|
+
*/
|
|
126
|
+
function strictEqual(a, b) {
|
|
127
|
+
return a === b;
|
|
28
128
|
}
|
|
29
|
-
|
|
30
|
-
|
|
129
|
+
/**
|
|
130
|
+
* Whether the array buffers are equal in value.
|
|
131
|
+
*/
|
|
132
|
+
function areArrayBuffersEqual(a, b) {
|
|
133
|
+
return a.byteLength === b.byteLength && areTypedArraysEqual(new Uint8Array(a), new Uint8Array(b));
|
|
31
134
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
135
|
+
/**
|
|
136
|
+
* Whether the arrays are equal in value.
|
|
137
|
+
*/
|
|
138
|
+
function areArraysEqual(a, b, state) {
|
|
139
|
+
let index = a.length;
|
|
140
|
+
if (b.length !== index) return false;
|
|
141
|
+
while (index-- > 0) if (!state.equals(a[index], b[index], index, index, a, b, state)) return false;
|
|
142
|
+
return true;
|
|
37
143
|
}
|
|
38
|
-
|
|
39
|
-
|
|
144
|
+
/**
|
|
145
|
+
* Whether the dataviews are equal in value.
|
|
146
|
+
*/
|
|
147
|
+
function areDataViewsEqual(a, b) {
|
|
148
|
+
return a.byteLength === b.byteLength && areTypedArraysEqual(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength));
|
|
40
149
|
}
|
|
41
|
-
|
|
42
|
-
|
|
150
|
+
/**
|
|
151
|
+
* Whether the dates passed are equal in value.
|
|
152
|
+
*/
|
|
153
|
+
function areDatesEqual(a, b) {
|
|
154
|
+
return sameValueEqual(a.getTime(), b.getTime());
|
|
43
155
|
}
|
|
44
|
-
|
|
45
|
-
|
|
156
|
+
/**
|
|
157
|
+
* Whether the errors passed are equal in value.
|
|
158
|
+
*
|
|
159
|
+
* @note
|
|
160
|
+
* `name`, `message` and `stack` are own properties but are not enumerable, so they are compared
|
|
161
|
+
* explicitly. `cause` and `errors` are compared by value rather than by reference, matching how
|
|
162
|
+
* every other nested value in the comparison is treated. They are compared exactly once, regardless
|
|
163
|
+
* of whether they were assigned (enumerable) or set by the constructor (non-enumerable). Other own
|
|
164
|
+
* enumerable properties (which custom `Error` subclasses commonly add) are compared afterward.
|
|
165
|
+
*
|
|
166
|
+
* The own property comparison is inlined rather than extracted, which measured faster in V8 when
|
|
167
|
+
* recursing through `cause`. Keep the bytecode under V8's 460-byte TurboFan inlining limit (383 bytes
|
|
168
|
+
* at time of writing; check with `node --print-bytecode --print-bytecode-filter=areErrorsEqual`), or
|
|
169
|
+
* this stops being inlined into its callers.
|
|
170
|
+
*/
|
|
171
|
+
function areErrorsEqual(a, b, state) {
|
|
172
|
+
if (a.name !== b.name || a.message !== b.message || a.stack !== b.stack) return false;
|
|
173
|
+
const causeA = a.cause;
|
|
174
|
+
const causeB = b.cause;
|
|
175
|
+
if (causeA !== causeB && !state.equals(causeA, causeB, "cause", "cause", a, b, state)) return false;
|
|
176
|
+
const errorsA = a.errors;
|
|
177
|
+
const errorsB = b.errors;
|
|
178
|
+
if (errorsA !== errorsB && !state.equals(errorsA, errorsB, "errors", "errors", a, b, state)) return false;
|
|
179
|
+
const propertiesA = keys(a);
|
|
180
|
+
const propertiesB = keys(b);
|
|
181
|
+
let index = propertiesA.length;
|
|
182
|
+
if (!index && !propertiesB.length) return true;
|
|
183
|
+
let compared = 0;
|
|
184
|
+
let property;
|
|
185
|
+
while (index-- > 0) {
|
|
186
|
+
property = propertiesA[index];
|
|
187
|
+
if (property === "cause" || property === "errors") continue;
|
|
188
|
+
if (property !== propertiesB[index] && !propertyIsEnumerable.call(b, property) || !state.equals(a[property], b[property], property, property, a, b, state)) return false;
|
|
189
|
+
++compared;
|
|
190
|
+
}
|
|
191
|
+
const remaining = propertiesB.length - compared;
|
|
192
|
+
return !remaining || remaining === (propertyIsEnumerable.call(b, "cause") ? 1 : 0) + (propertyIsEnumerable.call(b, "errors") ? 1 : 0);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Whether the errors passed are equal in value.
|
|
196
|
+
*
|
|
197
|
+
* @note
|
|
198
|
+
* `name`, `message` and `stack` are own properties but are not enumerable, so they are compared
|
|
199
|
+
* explicitly. `cause` and `errors` are own properties, so `areObjectsEqualStrict` compares them along
|
|
200
|
+
* with every other own property; they are not compared explicitly to avoid comparing them twice.
|
|
201
|
+
*/
|
|
202
|
+
function areErrorsEqualStrict(a, b, state) {
|
|
203
|
+
return a.name === b.name && a.message === b.message && a.stack === b.stack && areObjectsEqualStrict(a, b, state);
|
|
46
204
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
205
|
+
/**
|
|
206
|
+
* Whether the `Map`s are equal in value.
|
|
207
|
+
*/
|
|
208
|
+
function areMapsEqual(a, b, state) {
|
|
209
|
+
const size = a.size;
|
|
210
|
+
if (size !== b.size) return false;
|
|
211
|
+
if (!size) return true;
|
|
212
|
+
const matchedIndices = new Array(size);
|
|
213
|
+
const aIterable = a.entries();
|
|
214
|
+
let aResult;
|
|
215
|
+
let bResult;
|
|
216
|
+
let index = 0;
|
|
217
|
+
while (aResult = aIterable.next()) {
|
|
218
|
+
if (aResult.done) break;
|
|
219
|
+
const bIterable = b.entries();
|
|
220
|
+
let hasMatch = false;
|
|
221
|
+
let matchIndex = 0;
|
|
222
|
+
while (bResult = bIterable.next()) {
|
|
223
|
+
if (bResult.done) break;
|
|
224
|
+
if (matchedIndices[matchIndex]) {
|
|
225
|
+
matchIndex++;
|
|
57
226
|
continue;
|
|
58
227
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
228
|
+
const aEntry = aResult.value;
|
|
229
|
+
const bEntry = bResult.value;
|
|
230
|
+
if (state.equals(aEntry[0], bEntry[0], index, matchIndex, a, b, state) && state.equals(aEntry[1], bEntry[1], aEntry[0], bEntry[0], a, b, state)) {
|
|
231
|
+
hasMatch = matchedIndices[matchIndex] = true;
|
|
62
232
|
break;
|
|
63
233
|
}
|
|
64
|
-
|
|
234
|
+
matchIndex++;
|
|
65
235
|
}
|
|
66
|
-
if (!
|
|
67
|
-
|
|
236
|
+
if (!hasMatch) return false;
|
|
237
|
+
index++;
|
|
238
|
+
}
|
|
239
|
+
return true;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Whether the objects are equal in value.
|
|
243
|
+
*/
|
|
244
|
+
function areObjectsEqual(a, b, state) {
|
|
245
|
+
const properties = keys(a);
|
|
246
|
+
const propertiesB = keys(b);
|
|
247
|
+
let index = properties.length;
|
|
248
|
+
if (propertiesB.length !== index) return false;
|
|
249
|
+
const isScannable = index <= MAX_SCANNED_PROPERTIES;
|
|
250
|
+
let property;
|
|
251
|
+
while (index-- > 0) {
|
|
252
|
+
property = properties[index];
|
|
253
|
+
if (isReactProperty(a, b, property)) continue;
|
|
254
|
+
if (property !== propertiesB[index] && !(isScannable ? propertiesB.includes(property) : propertyIsEnumerable.call(b, property)) || !state.equals(a[property], b[property], property, property, a, b, state)) return false;
|
|
68
255
|
}
|
|
69
|
-
return
|
|
256
|
+
return true;
|
|
70
257
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
258
|
+
/**
|
|
259
|
+
* Whether the objects are equal in value with strict property checking.
|
|
260
|
+
*/
|
|
261
|
+
function areObjectsEqualStrict(a, b, state) {
|
|
262
|
+
const properties = getStrictProperties(a);
|
|
263
|
+
return getStrictProperties(b).length === properties.length && areStrictPropertiesEqual(a, b, state, properties, 0);
|
|
76
264
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return !0;
|
|
265
|
+
/**
|
|
266
|
+
* Whether the primitive wrappers passed are equal in value.
|
|
267
|
+
*/
|
|
268
|
+
function arePrimitiveWrappersEqual(a, b) {
|
|
269
|
+
return sameValueEqual(a.valueOf(), b.valueOf());
|
|
83
270
|
}
|
|
84
|
-
|
|
85
|
-
|
|
271
|
+
/**
|
|
272
|
+
* Whether the regexps passed are equal in value.
|
|
273
|
+
*/
|
|
274
|
+
function areRegExpsEqual(a, b) {
|
|
275
|
+
return a.source === b.source && a.flags === b.flags;
|
|
86
276
|
}
|
|
87
|
-
|
|
88
|
-
|
|
277
|
+
/**
|
|
278
|
+
* Whether the search params passed are equal in value.
|
|
279
|
+
*
|
|
280
|
+
* @note
|
|
281
|
+
* Order is not significant, matching how the other unordered collections in the library are
|
|
282
|
+
* compared. Repeated keys are, so this is a comparison of multisets rather than of sets:
|
|
283
|
+
* `a=1&a=2` is equal to `a=2&a=1`, but not to `a=1&a=1`.
|
|
284
|
+
*/
|
|
285
|
+
function areSearchParamsEqual(a, b) {
|
|
286
|
+
const serializedA = a.toString();
|
|
287
|
+
const serializedB = b.toString();
|
|
288
|
+
return serializedA === serializedB || sortSearchParams(serializedA) === sortSearchParams(serializedB);
|
|
89
289
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
290
|
+
/**
|
|
291
|
+
* Whether the `Set`s are equal in value.
|
|
292
|
+
*/
|
|
293
|
+
function areSetsEqual(a, b, state) {
|
|
294
|
+
const size = a.size;
|
|
295
|
+
if (size !== b.size) return false;
|
|
296
|
+
if (!size) return true;
|
|
297
|
+
const matchedIndices = new Array(size);
|
|
298
|
+
const aIterable = a.values();
|
|
299
|
+
let aResult;
|
|
300
|
+
let bResult;
|
|
301
|
+
while (aResult = aIterable.next()) {
|
|
302
|
+
if (aResult.done) break;
|
|
303
|
+
const bIterable = b.values();
|
|
304
|
+
let hasMatch = false;
|
|
305
|
+
let matchIndex = 0;
|
|
306
|
+
while (bResult = bIterable.next()) {
|
|
307
|
+
if (bResult.done) break;
|
|
308
|
+
if (!matchedIndices[matchIndex] && state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {
|
|
309
|
+
hasMatch = matchedIndices[matchIndex] = true;
|
|
100
310
|
break;
|
|
101
311
|
}
|
|
102
|
-
|
|
312
|
+
matchIndex++;
|
|
103
313
|
}
|
|
104
|
-
if (!
|
|
314
|
+
if (!hasMatch) return false;
|
|
105
315
|
}
|
|
106
|
-
return
|
|
316
|
+
return true;
|
|
107
317
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
318
|
+
/**
|
|
319
|
+
* Whether the TypedArray instances are equal in value.
|
|
320
|
+
*/
|
|
321
|
+
function areTypedArraysEqual(a, b) {
|
|
322
|
+
let index = a.length;
|
|
323
|
+
if (b.length !== index || a.byteOffset !== b.byteOffset) return false;
|
|
324
|
+
const tag = getTypedArrayTag.call(a);
|
|
325
|
+
if (tag === "Float64Array" || tag === "Float32Array" || tag === "Float16Array") {
|
|
326
|
+
while (index-- > 0) if (a[index] !== b[index] && (a[index] === a[index] || b[index] === b[index])) return false;
|
|
327
|
+
return true;
|
|
114
328
|
}
|
|
115
|
-
|
|
116
|
-
return
|
|
329
|
+
while (index-- > 0) if (a[index] !== b[index]) return false;
|
|
330
|
+
return true;
|
|
117
331
|
}
|
|
118
|
-
|
|
119
|
-
|
|
332
|
+
/**
|
|
333
|
+
* Whether the TypedArray instances are equal in value with strict property checking.
|
|
334
|
+
*
|
|
335
|
+
* @note
|
|
336
|
+
* Indexed elements are also own properties, listed first and in order, with descriptors fixed by the
|
|
337
|
+
* spec. They are compared once by `areTypedArraysEqual`, so only the own properties after them
|
|
338
|
+
* (including symbols) are compared with strict property checking.
|
|
339
|
+
*/
|
|
340
|
+
function areTypedArraysEqualStrict(a, b, state) {
|
|
341
|
+
if (!areTypedArraysEqual(a, b)) return false;
|
|
342
|
+
const properties = getStrictProperties(a);
|
|
343
|
+
return getStrictProperties(b).length === properties.length && areStrictPropertiesEqual(a, b, state, properties, a.length);
|
|
120
344
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
345
|
+
/**
|
|
346
|
+
* Whether the URL instances are equal in value.
|
|
347
|
+
*/
|
|
348
|
+
function areUrlsEqual(a, b) {
|
|
349
|
+
if (a.href === b.href) return true;
|
|
350
|
+
return a.protocol === b.protocol && a.username === b.username && a.password === b.password && a.host === b.host && a.pathname === b.pathname && a.hash === b.hash && areSearchParamsEqual(a.searchParams, b.searchParams);
|
|
124
351
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
352
|
+
var { toString } = Object.prototype;
|
|
353
|
+
/**
|
|
354
|
+
* Create a comparator method based on the type-specific equality comparators passed.
|
|
355
|
+
*/
|
|
356
|
+
function createEqualityComparator(config) {
|
|
357
|
+
const supportedComparatorMap = createSupportedComparatorMap(config);
|
|
358
|
+
const { areArraysEqual, areDatesEqual, areFunctionsEqual, areMapsEqual, areNumbersEqual, areObjectsEqual, areRegExpsEqual, areSetsEqual, getUnsupportedCustomComparator, strictNullPrototypeComparison } = config;
|
|
359
|
+
/**
|
|
360
|
+
* Whether the custom objects are equal in value, based on their string tag. If not matching any tags
|
|
361
|
+
* that require a specific type of comparison, then we hard-code false because the only thing remaining
|
|
362
|
+
* is strict equality, which has already been compared. This is for a few reasons:
|
|
363
|
+
* - Certain types that cannot be introspected (e.g., `WeakMap`). For these types, this is the only
|
|
364
|
+
* comparison that can be made.
|
|
365
|
+
* - For types that can be introspected but do not have an objective definition of what
|
|
366
|
+
* equality is (`Error`, etc.), the subjective decision is to be conservative and strictly compare.
|
|
367
|
+
* In all cases, these decisions should be reevaluated based on changes to the language and
|
|
368
|
+
* common development practices.
|
|
369
|
+
*
|
|
370
|
+
* Capturing the tag is reasonably performant in modern environments like v8 and SpiderMonkey. This is
|
|
371
|
+
* kept out of the main comparator so that it stays within the engine's bytecode budget for inlining.
|
|
372
|
+
* See [#207](https://github.com/planttheidea/fast-equals/pull/207) for more details.
|
|
373
|
+
*/
|
|
374
|
+
const areTaggedObjectsEqual = getUnsupportedCustomComparator ? function areTaggedObjectsEqual(a, b, state) {
|
|
375
|
+
const tag = toString.call(a);
|
|
376
|
+
const supportedComparator = supportedComparatorMap[tag];
|
|
377
|
+
if (supportedComparator) return supportedComparator(a, b, state);
|
|
378
|
+
const unsupportedCustomComparator = getUnsupportedCustomComparator(a, b, state, tag);
|
|
379
|
+
return unsupportedCustomComparator ? unsupportedCustomComparator(a, b, state) : false;
|
|
380
|
+
} : function areTaggedObjectsEqual(a, b, state) {
|
|
381
|
+
const supportedComparator = supportedComparatorMap[toString.call(a)];
|
|
382
|
+
return supportedComparator ? supportedComparator(a, b, state) : false;
|
|
383
|
+
};
|
|
384
|
+
/**
|
|
385
|
+
* compare the value of the two objects and return true if they are equivalent in values
|
|
386
|
+
*/
|
|
387
|
+
return function comparator(a, b, state) {
|
|
388
|
+
if (a === b) return true;
|
|
389
|
+
if (a == null || b == null) return false;
|
|
390
|
+
const type = typeof a;
|
|
391
|
+
if (type !== typeof b) return false;
|
|
392
|
+
if (type !== "object") {
|
|
393
|
+
if (type === "number" || type === "bigint") return areNumbersEqual(a, b, state);
|
|
394
|
+
if (type === "function") return areFunctionsEqual(a, b, state);
|
|
395
|
+
return false;
|
|
396
|
+
}
|
|
397
|
+
const constructor = a.constructor;
|
|
398
|
+
if (constructor !== b.constructor) return strictNullPrototypeComparison ? false : isNullPrototypeComparable(a, b) && areObjectsEqual(a, b, state);
|
|
399
|
+
if (constructor === Object) return areObjectsEqual(a, b, state);
|
|
400
|
+
if (constructor === Array) return areArraysEqual(a, b, state);
|
|
401
|
+
if (constructor === Date) return areDatesEqual(a, b, state);
|
|
402
|
+
if (constructor === RegExp) return areRegExpsEqual(a, b, state);
|
|
403
|
+
if (constructor === Map) return areMapsEqual(a, b, state);
|
|
404
|
+
if (constructor === Set) return areSetsEqual(a, b, state);
|
|
405
|
+
if (constructor == null) return areObjectsEqual(a, b, state);
|
|
406
|
+
if (constructor === Promise) return false;
|
|
407
|
+
if (Array.isArray(a)) return areArraysEqual(a, b, state);
|
|
408
|
+
return areTaggedObjectsEqual(a, b, state);
|
|
154
409
|
};
|
|
155
410
|
}
|
|
156
|
-
|
|
157
|
-
|
|
411
|
+
/**
|
|
412
|
+
* Create the configuration object used for building comparators.
|
|
413
|
+
*/
|
|
414
|
+
function createEqualityComparatorConfig({ circular, createCustomConfig, strict, strictNullPrototypeComparison = true }) {
|
|
415
|
+
let config = {
|
|
158
416
|
areArrayBuffersEqual,
|
|
159
|
-
areArraysEqual:
|
|
417
|
+
areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,
|
|
160
418
|
areDataViewsEqual,
|
|
161
|
-
areDatesEqual,
|
|
162
|
-
areErrorsEqual:
|
|
419
|
+
areDatesEqual: strict ? combineComparators(areDatesEqual, areObjectsEqualStrict) : areDatesEqual,
|
|
420
|
+
areErrorsEqual: strict ? areErrorsEqualStrict : areErrorsEqual,
|
|
163
421
|
areFunctionsEqual: strictEqual,
|
|
164
|
-
areMapsEqual:
|
|
165
|
-
areNumbersEqual:
|
|
166
|
-
areObjectsEqual:
|
|
422
|
+
areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
|
|
423
|
+
areNumbersEqual: sameValueEqual,
|
|
424
|
+
areObjectsEqual: strict ? areObjectsEqualStrict : areObjectsEqual,
|
|
167
425
|
arePrimitiveWrappersEqual,
|
|
168
426
|
areRegExpsEqual,
|
|
169
|
-
areSetsEqual:
|
|
170
|
-
areTypedArraysEqual:
|
|
427
|
+
areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
|
|
428
|
+
areTypedArraysEqual: strict ? areTypedArraysEqualStrict : areTypedArraysEqual,
|
|
171
429
|
areUrlsEqual,
|
|
172
|
-
getUnsupportedCustomComparator: void 0
|
|
430
|
+
getUnsupportedCustomComparator: void 0,
|
|
431
|
+
strictNullPrototypeComparison
|
|
173
432
|
};
|
|
174
|
-
if (
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
433
|
+
if (createCustomConfig) config = Object.assign({}, config, createCustomConfig(config));
|
|
434
|
+
if (circular) {
|
|
435
|
+
const areArraysEqual = createIsCircular(config.areArraysEqual);
|
|
436
|
+
const areDatesEqual = strict ? createIsCircular(config.areDatesEqual) : config.areDatesEqual;
|
|
437
|
+
const areErrorsEqual = createIsCircular(config.areErrorsEqual);
|
|
438
|
+
const areMapsEqual = createIsCircular(config.areMapsEqual);
|
|
439
|
+
const areObjectsEqual = createIsCircular(config.areObjectsEqual);
|
|
440
|
+
const areSetsEqual = createIsCircular(config.areSetsEqual);
|
|
441
|
+
const areTypedArraysEqual = strict ? createIsCircular(config.areTypedArraysEqual) : config.areTypedArraysEqual;
|
|
442
|
+
config = Object.assign({}, config, {
|
|
443
|
+
areArraysEqual,
|
|
444
|
+
areDatesEqual,
|
|
445
|
+
areErrorsEqual,
|
|
446
|
+
areMapsEqual,
|
|
447
|
+
areObjectsEqual,
|
|
448
|
+
areSetsEqual,
|
|
449
|
+
areTypedArraysEqual
|
|
182
450
|
});
|
|
183
451
|
}
|
|
184
|
-
return
|
|
452
|
+
return config;
|
|
185
453
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
454
|
+
/**
|
|
455
|
+
* Default equality comparator pass-through, used as the standard `isEqual` creator for
|
|
456
|
+
* use inside the built comparator.
|
|
457
|
+
*/
|
|
458
|
+
function createInternalEqualityComparator(compare) {
|
|
459
|
+
return function(a, b, _indexOrKeyA, _indexOrKeyB, _parentA, _parentB, state) {
|
|
460
|
+
return compare(a, b, state);
|
|
189
461
|
};
|
|
190
462
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
463
|
+
/**
|
|
464
|
+
* Create the `isEqual` function used by the consuming application.
|
|
465
|
+
*/
|
|
466
|
+
function createIsEqual({ circular, comparator, createState, equals, strict }) {
|
|
467
|
+
if (createState) return function isEqual(a, b) {
|
|
468
|
+
const { cache = circular ? /* @__PURE__ */ new WeakMap() : void 0, meta } = createState();
|
|
469
|
+
return comparator(a, b, {
|
|
470
|
+
cache,
|
|
471
|
+
equals,
|
|
472
|
+
meta,
|
|
473
|
+
strict
|
|
199
474
|
});
|
|
200
475
|
};
|
|
201
|
-
if (
|
|
202
|
-
return
|
|
476
|
+
if (circular) return function isEqual(a, b) {
|
|
477
|
+
return comparator(a, b, {
|
|
203
478
|
cache: /* @__PURE__ */ new WeakMap(),
|
|
204
|
-
equals
|
|
479
|
+
equals,
|
|
205
480
|
meta: void 0,
|
|
206
|
-
strict
|
|
481
|
+
strict
|
|
207
482
|
});
|
|
208
483
|
};
|
|
209
|
-
|
|
484
|
+
const state = {
|
|
210
485
|
cache: void 0,
|
|
211
|
-
equals
|
|
486
|
+
equals,
|
|
212
487
|
meta: void 0,
|
|
213
|
-
strict
|
|
488
|
+
strict
|
|
214
489
|
};
|
|
215
|
-
return function isEqual(
|
|
216
|
-
return
|
|
490
|
+
return function isEqual(a, b) {
|
|
491
|
+
return comparator(a, b, state);
|
|
217
492
|
};
|
|
218
493
|
}
|
|
219
|
-
|
|
494
|
+
/**
|
|
495
|
+
* Create a map of `toString()` values to their respective handlers for `tag`-based lookups.
|
|
496
|
+
*/
|
|
497
|
+
function createSupportedComparatorMap({ areArrayBuffersEqual, areArraysEqual, areDataViewsEqual, areDatesEqual, areErrorsEqual, areFunctionsEqual, areMapsEqual, areObjectsEqual, arePrimitiveWrappersEqual, areRegExpsEqual, areSetsEqual, areTypedArraysEqual, areUrlsEqual }) {
|
|
220
498
|
return {
|
|
221
|
-
"[object Arguments]":
|
|
222
|
-
"[object Array]":
|
|
223
|
-
"[object ArrayBuffer]":
|
|
224
|
-
"[object AsyncGeneratorFunction]":
|
|
225
|
-
"[object BigInt]":
|
|
226
|
-
"[object BigInt64Array]":
|
|
227
|
-
"[object BigUint64Array]":
|
|
228
|
-
"[object Boolean]":
|
|
229
|
-
"[object DataView]":
|
|
230
|
-
"[object Date]":
|
|
231
|
-
"[object Error]":
|
|
232
|
-
"[object Float16Array]":
|
|
233
|
-
"[object Float32Array]":
|
|
234
|
-
"[object Float64Array]":
|
|
235
|
-
"[object Function]":
|
|
236
|
-
"[object GeneratorFunction]":
|
|
237
|
-
"[object Int8Array]":
|
|
238
|
-
"[object Int16Array]":
|
|
239
|
-
"[object Int32Array]":
|
|
240
|
-
"[object Map]":
|
|
241
|
-
"[object Number]":
|
|
242
|
-
"[object Object]": (
|
|
243
|
-
"[object RegExp]":
|
|
244
|
-
"[object Set]":
|
|
245
|
-
"[object String]":
|
|
246
|
-
"[object URL]":
|
|
247
|
-
"[object Uint8Array]":
|
|
248
|
-
"[object Uint8ClampedArray]":
|
|
249
|
-
"[object Uint16Array]":
|
|
250
|
-
"[object Uint32Array]":
|
|
499
|
+
"[object Arguments]": areObjectsEqual,
|
|
500
|
+
"[object Array]": areArraysEqual,
|
|
501
|
+
"[object ArrayBuffer]": areArrayBuffersEqual,
|
|
502
|
+
"[object AsyncGeneratorFunction]": areFunctionsEqual,
|
|
503
|
+
"[object BigInt]": arePrimitiveWrappersEqual,
|
|
504
|
+
"[object BigInt64Array]": areTypedArraysEqual,
|
|
505
|
+
"[object BigUint64Array]": areTypedArraysEqual,
|
|
506
|
+
"[object Boolean]": arePrimitiveWrappersEqual,
|
|
507
|
+
"[object DataView]": areDataViewsEqual,
|
|
508
|
+
"[object Date]": areDatesEqual,
|
|
509
|
+
"[object Error]": areErrorsEqual,
|
|
510
|
+
"[object Float16Array]": areTypedArraysEqual,
|
|
511
|
+
"[object Float32Array]": areTypedArraysEqual,
|
|
512
|
+
"[object Float64Array]": areTypedArraysEqual,
|
|
513
|
+
"[object Function]": areFunctionsEqual,
|
|
514
|
+
"[object GeneratorFunction]": areFunctionsEqual,
|
|
515
|
+
"[object Int8Array]": areTypedArraysEqual,
|
|
516
|
+
"[object Int16Array]": areTypedArraysEqual,
|
|
517
|
+
"[object Int32Array]": areTypedArraysEqual,
|
|
518
|
+
"[object Map]": areMapsEqual,
|
|
519
|
+
"[object Number]": arePrimitiveWrappersEqual,
|
|
520
|
+
"[object Object]": (a, b, state) => typeof a.then !== "function" && typeof b.then !== "function" && areObjectsEqual(a, b, state),
|
|
521
|
+
"[object RegExp]": areRegExpsEqual,
|
|
522
|
+
"[object Set]": areSetsEqual,
|
|
523
|
+
"[object String]": arePrimitiveWrappersEqual,
|
|
524
|
+
"[object URL]": areUrlsEqual,
|
|
525
|
+
"[object Uint8Array]": areTypedArraysEqual,
|
|
526
|
+
"[object Uint8ClampedArray]": areTypedArraysEqual,
|
|
527
|
+
"[object Uint16Array]": areTypedArraysEqual,
|
|
528
|
+
"[object Uint32Array]": areTypedArraysEqual
|
|
251
529
|
};
|
|
252
530
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
531
|
+
/**
|
|
532
|
+
* Whether the items passed are deeply-equal in value.
|
|
533
|
+
*/
|
|
534
|
+
var deepEqual = createCustomEqual();
|
|
535
|
+
createCustomEqual({ strict: true });
|
|
536
|
+
createCustomEqual({ circular: true });
|
|
537
|
+
createCustomEqual({
|
|
538
|
+
circular: true,
|
|
539
|
+
strict: true
|
|
540
|
+
});
|
|
541
|
+
createCustomEqual({ createInternalComparator: () => sameValueEqual });
|
|
542
|
+
createCustomEqual({
|
|
543
|
+
strict: true,
|
|
544
|
+
createInternalComparator: () => sameValueEqual
|
|
545
|
+
});
|
|
546
|
+
createCustomEqual({
|
|
547
|
+
circular: true,
|
|
548
|
+
createInternalComparator: () => sameValueEqual
|
|
257
549
|
});
|
|
258
|
-
var p = createCustomEqual({ createInternalComparator: () => u });
|
|
259
550
|
createCustomEqual({
|
|
260
|
-
|
|
261
|
-
createInternalComparator: () =>
|
|
262
|
-
|
|
263
|
-
circular: !0,
|
|
264
|
-
createInternalComparator: () => u
|
|
265
|
-
}), createCustomEqual({
|
|
266
|
-
circular: !0,
|
|
267
|
-
createInternalComparator: () => u,
|
|
268
|
-
strict: !0
|
|
551
|
+
circular: true,
|
|
552
|
+
createInternalComparator: () => sameValueEqual,
|
|
553
|
+
strict: true
|
|
269
554
|
});
|
|
270
|
-
|
|
271
|
-
|
|
555
|
+
/**
|
|
556
|
+
* Create a custom equality comparison method.
|
|
557
|
+
*
|
|
558
|
+
* This can be done to create very targeted comparisons in extreme hot-path scenarios
|
|
559
|
+
* where the standard methods are not performant enough, but can also be used to provide
|
|
560
|
+
* support for legacy environments that do not support expected features like
|
|
561
|
+
* `RegExp.prototype.flags` out of the box.
|
|
562
|
+
*/
|
|
563
|
+
function createCustomEqual(options = {}) {
|
|
564
|
+
const { circular = false, createInternalComparator: createCustomInternalComparator, createState, strict = false } = options;
|
|
565
|
+
const comparator = createEqualityComparator(createEqualityComparatorConfig(options));
|
|
272
566
|
return createIsEqual({
|
|
273
|
-
circular
|
|
274
|
-
comparator
|
|
275
|
-
createState
|
|
276
|
-
equals:
|
|
277
|
-
strict
|
|
567
|
+
circular,
|
|
568
|
+
comparator,
|
|
569
|
+
createState,
|
|
570
|
+
equals: createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator),
|
|
571
|
+
strict
|
|
278
572
|
});
|
|
279
573
|
}
|
|
280
|
-
|
|
281
|
-
export { p as n, f as t };
|
|
574
|
+
export { deepEqual as t };
|