summaryrefslogtreecommitdiff
path: root/node_modules/babel-helper-is-nodes-equiv/lib
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2024-08-30 17:21:18 +0800
committerlittleblack111 <littleblack11111@gmail.com>2024-08-30 17:21:18 +0800
commitefbc2ffe6a1ee5ec38a4396305561d6515d0943e (patch)
tree2b4c94f18f2c792dfda813050755d5c0273fae22 /node_modules/babel-helper-is-nodes-equiv/lib
parent43acceb75957c880a5ba5a31aae221394a36d5f6 (diff)
node fixes, updates
Diffstat (limited to 'node_modules/babel-helper-is-nodes-equiv/lib')
-rw-r--r--node_modules/babel-helper-is-nodes-equiv/lib/index.js68
1 files changed, 68 insertions, 0 deletions
diff --git a/node_modules/babel-helper-is-nodes-equiv/lib/index.js b/node_modules/babel-helper-is-nodes-equiv/lib/index.js
new file mode 100644
index 00000000..92b9b971
--- /dev/null
+++ b/node_modules/babel-helper-is-nodes-equiv/lib/index.js
@@ -0,0 +1,68 @@
+"use strict";
+
+var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
+
+module.exports = function (t) {
+ function equiv(a, b) {
+ if ((typeof a === "undefined" ? "undefined" : _typeof(a)) !== "object" || (typeof a === "undefined" ? "undefined" : _typeof(a)) !== "object" || a == null || b == null) {
+ return a === b;
+ }
+
+ if (a.type !== b.type) {
+ return false;
+ }
+
+ var fields = Object.keys(t.NODE_FIELDS[a.type]);
+
+ var _iteratorNormalCompletion = true;
+ var _didIteratorError = false;
+ var _iteratorError = undefined;
+
+ try {
+ for (var _iterator = fields[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
+ var field = _step.value;
+
+ if (_typeof(a[field]) !== _typeof(b[field])) {
+ return false;
+ }
+
+ if (Array.isArray(a[field])) {
+ if (!Array.isArray(b[field])) {
+ return false;
+ }
+ if (a[field].length !== b[field].length) {
+ return false;
+ }
+
+ for (var i = 0; i < a[field].length; i++) {
+ if (!equiv(a[field][i], b[field][i])) {
+ return false;
+ }
+ }
+ continue;
+ }
+
+ if (!equiv(a[field], b[field])) {
+ return false;
+ }
+ }
+ } catch (err) {
+ _didIteratorError = true;
+ _iteratorError = err;
+ } finally {
+ try {
+ if (!_iteratorNormalCompletion && _iterator.return) {
+ _iterator.return();
+ }
+ } finally {
+ if (_didIteratorError) {
+ throw _iteratorError;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ return equiv;
+}; \ No newline at end of file