UNPKG

bootstrap-vue

Version:

BootstrapVue, with over 40 plugins and more than 75 custom components, provides one of the most comprehensive implementations of Bootstrap v4 components and grid system for Vue.js. With extensive and automated WAI-ARIA accessibility markup.

81 lines (60 loc) 1.87 kB
"use strict"; exports.__esModule = true; exports.default = void 0; var _object = require("./object"); var _inspect = require("./inspect"); // Assumes both a and b are arrays! // Handles when arrays are "sparse" (array.every(...) doesn't handle sparse) var compareArrays = function compareArrays(a, b) { if (a.length !== b.length) { return false; } var equal = true; for (var i = 0; equal && i < a.length; i++) { equal = looseEqual(a[i], b[i]); } return equal; }; /** * Check if two values are loosely equal - that is, * if they are plain objects, do they have the same shape? * Returns boolean true or false */ var looseEqual = function looseEqual(a, b) { if (a === b) { return true; } var aValidType = (0, _inspect.isDate)(a); var bValidType = (0, _inspect.isDate)(b); if (aValidType || bValidType) { return aValidType && bValidType ? a.getTime() === b.getTime() : false; } aValidType = (0, _inspect.isArray)(a); bValidType = (0, _inspect.isArray)(b); if (aValidType || bValidType) { return aValidType && bValidType ? compareArrays(a, b) : false; } aValidType = (0, _inspect.isObject)(a); bValidType = (0, _inspect.isObject)(b); if (aValidType || bValidType) { /* istanbul ignore if: this if will probably never be called */ if (!aValidType || !bValidType) { return false; } var aKeysCount = (0, _object.keys)(a).length; var bKeysCount = (0, _object.keys)(b).length; if (aKeysCount !== bKeysCount) { return false; } for (var key in a) { var aHasKey = a.hasOwnProperty(key); var bHasKey = b.hasOwnProperty(key); if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) { return false; } } } return String(a) === String(b); }; var _default = looseEqual; exports.default = _default;