@fastkit/helpers
Advanced tools
Comparing version 0.6.20 to 0.6.28
@@ -126,2 +126,29 @@ 'use strict'; | ||
} | ||
/** | ||
* @see: https://github.com/vuejs/vue-router/blob/c69ff7bd60228fb79acd764c3fdae91015a49103/src/util/route.js#L96 | ||
*/ | ||
function isObjectEqual(a = {}, b) { | ||
// handle null value #1566 | ||
if (!a || !b) | ||
return a === b; | ||
if (!isObject(b)) | ||
return false; | ||
const aKeys = Object.keys(a); | ||
const bKeys = Object.keys(b); | ||
if (aKeys.length !== bKeys.length) { | ||
return false; | ||
} | ||
return aKeys.every((key) => { | ||
const aVal = a[key]; | ||
const bVal = b[key]; | ||
// query values can be null and undefined | ||
if (aVal == null || bVal == null) | ||
return aVal === bVal; | ||
// check nested equality | ||
if (typeof aVal === 'object' && typeof bVal === 'object') { | ||
return isObjectEqual(aVal, bVal); | ||
} | ||
return String(aVal) === String(bVal); | ||
}); | ||
} | ||
@@ -660,2 +687,3 @@ function flattenRecursiveArray(source) { | ||
exports.isObject = isObject; | ||
exports.isObjectEqual = isObjectEqual; | ||
exports.isPromise = isPromise; | ||
@@ -662,0 +690,0 @@ exports.isSameFlattendComparatorCondition = isSameFlattendComparatorCondition; |
@@ -126,2 +126,29 @@ 'use strict'; | ||
} | ||
/** | ||
* @see: https://github.com/vuejs/vue-router/blob/c69ff7bd60228fb79acd764c3fdae91015a49103/src/util/route.js#L96 | ||
*/ | ||
function isObjectEqual(a = {}, b) { | ||
// handle null value #1566 | ||
if (!a || !b) | ||
return a === b; | ||
if (!isObject(b)) | ||
return false; | ||
const aKeys = Object.keys(a); | ||
const bKeys = Object.keys(b); | ||
if (aKeys.length !== bKeys.length) { | ||
return false; | ||
} | ||
return aKeys.every((key) => { | ||
const aVal = a[key]; | ||
const bVal = b[key]; | ||
// query values can be null and undefined | ||
if (aVal == null || bVal == null) | ||
return aVal === bVal; | ||
// check nested equality | ||
if (typeof aVal === 'object' && typeof bVal === 'object') { | ||
return isObjectEqual(aVal, bVal); | ||
} | ||
return String(aVal) === String(bVal); | ||
}); | ||
} | ||
@@ -660,2 +687,3 @@ function flattenRecursiveArray(source) { | ||
exports.isObject = isObject; | ||
exports.isObjectEqual = isObjectEqual; | ||
exports.isPromise = isPromise; | ||
@@ -662,0 +690,0 @@ exports.isSameFlattendComparatorCondition = isSameFlattendComparatorCondition; |
@@ -154,2 +154,7 @@ /// <reference types="node" /> | ||
/** | ||
* @see: https://github.com/vuejs/vue-router/blob/c69ff7bd60228fb79acd764c3fdae91015a49103/src/util/route.js#L96 | ||
*/ | ||
export declare function isObjectEqual<T extends any>(a: T | undefined, b: unknown): b is T; | ||
export declare function isPromise<T = any>(obj: any): obj is Promise<T>; | ||
@@ -156,0 +161,0 @@ |
@@ -122,2 +122,29 @@ function toInt(value) { | ||
} | ||
/** | ||
* @see: https://github.com/vuejs/vue-router/blob/c69ff7bd60228fb79acd764c3fdae91015a49103/src/util/route.js#L96 | ||
*/ | ||
function isObjectEqual(a = {}, b) { | ||
// handle null value #1566 | ||
if (!a || !b) | ||
return a === b; | ||
if (!isObject(b)) | ||
return false; | ||
const aKeys = Object.keys(a); | ||
const bKeys = Object.keys(b); | ||
if (aKeys.length !== bKeys.length) { | ||
return false; | ||
} | ||
return aKeys.every((key) => { | ||
const aVal = a[key]; | ||
const bVal = b[key]; | ||
// query values can be null and undefined | ||
if (aVal == null || bVal == null) | ||
return aVal === bVal; | ||
// check nested equality | ||
if (typeof aVal === 'object' && typeof bVal === 'object') { | ||
return isObjectEqual(aVal, bVal); | ||
} | ||
return String(aVal) === String(bVal); | ||
}); | ||
} | ||
@@ -629,2 +656,2 @@ function flattenRecursiveArray(source) { | ||
export { Cloner, DATE_INPUT_PRECISIONS, DATE_INPUT_RE, DefaultComparatorConditionName, IN_DOCUMENT, IN_WINDOW, addTransitionEvent, addTransitionendEvent, arrayRemove, attemptFocus, clone, consoleColorString, copyBuffer, createComparatorCondition, debounce, escapeRegExp, flattenComparatorCondition, flattenRecursiveArray, focusFirstDescendant, isArrayBufferView, isBuffer, isComparatorConditionalValue, isEmpty, isFocusable, isIterableObject, isMap, isObject, isPromise, isSameFlattendComparatorCondition, isSet, isString, nilToEmptyString, notEmptyValue, objectIncludes, ownerDocument, ownerWindow, parseDateInput, pushDynamicStyle, range, resolveDebounceSettings, safeGetTimeByDateSource, safeJSONSerializer, safeJSONStringify, safeRemainderOperation, toComparableNumbers, toFloat, toHalfWidth, toInt, toNumber, toSingleSpace, traverseAndFlattenComparatorCondition }; | ||
export { Cloner, DATE_INPUT_PRECISIONS, DATE_INPUT_RE, DefaultComparatorConditionName, IN_DOCUMENT, IN_WINDOW, addTransitionEvent, addTransitionendEvent, arrayRemove, attemptFocus, clone, consoleColorString, copyBuffer, createComparatorCondition, debounce, escapeRegExp, flattenComparatorCondition, flattenRecursiveArray, focusFirstDescendant, isArrayBufferView, isBuffer, isComparatorConditionalValue, isEmpty, isFocusable, isIterableObject, isMap, isObject, isObjectEqual, isPromise, isSameFlattendComparatorCondition, isSet, isString, nilToEmptyString, notEmptyValue, objectIncludes, ownerDocument, ownerWindow, parseDateInput, pushDynamicStyle, range, resolveDebounceSettings, safeGetTimeByDateSource, safeJSONSerializer, safeJSONStringify, safeRemainderOperation, toComparableNumbers, toFloat, toHalfWidth, toInt, toNumber, toSingleSpace, traverseAndFlattenComparatorCondition }; |
{ | ||
"name": "@fastkit/helpers", | ||
"version": "0.6.20", | ||
"version": "0.6.28", | ||
"description": "@fastkit/helpers", | ||
@@ -5,0 +5,0 @@ "buildOptions": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
77666
2211