@sketch-hq/sketch-assistant-utils
Advanced tools
Comparing version 5.0.0-next.6 to 5.0.0-next.7
# @sketch-hq/sketch-assistant-utils | ||
## 5.0.0-next.7 | ||
### Patch Changes | ||
- f48a2de: Exclude 'do_objectID' and '\$pointer' attributes from the object hash function | ||
## 5.0.0-next.6 | ||
@@ -4,0 +10,0 @@ |
@@ -20,6 +20,12 @@ "use strict"; | ||
/** | ||
* Object hash comparison function that ignores 'do_objectID' and '$pointer' attributes | ||
*/ | ||
const stableObjectHash = (obj, excludeKeys = []) => { | ||
return object_utils_1.objectHash(obj, [...excludeKeys, 'do_objectID', '$pointer']); | ||
}; | ||
/** | ||
* Helper function that creates a string hash from a set of attributes of a style | ||
* object. | ||
*/ | ||
const styleHash = (style) => object_utils_1.objectHash({ | ||
const styleHash = (style) => stableObjectHash({ | ||
borders: style === null || style === void 0 ? void 0 : style.borders, | ||
@@ -43,3 +49,3 @@ borderOptions: style === null || style === void 0 ? void 0 : style.borderOptions, | ||
*/ | ||
const textStyleHash = (style) => object_utils_1.objectHash({ | ||
const textStyleHash = (style) => stableObjectHash({ | ||
borders: style === null || style === void 0 ? void 0 : style.borders, | ||
@@ -51,3 +57,3 @@ borderOptions: style === null || style === void 0 ? void 0 : style.borderOptions, | ||
innerShadows: style === null || style === void 0 ? void 0 : style.innerShadows, | ||
textStyle: style && style.textStyle ? object_utils_1.objectHash(style === null || style === void 0 ? void 0 : style.textStyle) : null, | ||
textStyle: style && style.textStyle ? stableObjectHash(style === null || style === void 0 ? void 0 : style.textStyle) : null, | ||
}); | ||
@@ -184,5 +190,3 @@ exports.textStyleHash = textStyleHash; | ||
nodeToObject: object_utils_1.nodeToObject, | ||
objectHash(obj, excludeKeys = []) { | ||
return object_utils_1.objectHash(obj, [...excludeKeys, 'do_objectID', '$pointer']); | ||
}, | ||
objectHash: stableObjectHash, | ||
objectsEqual(obj1, obj2, excludeKeys = []) { | ||
@@ -189,0 +193,0 @@ return object_utils_1.objectsEqual(obj1, obj2, [...excludeKeys, 'do_objectID', '$pointer']); |
@@ -8,6 +8,12 @@ import mem from 'mem'; | ||
/** | ||
* Object hash comparison function that ignores 'do_objectID' and '$pointer' attributes | ||
*/ | ||
const stableObjectHash = (obj, excludeKeys = []) => { | ||
return objectHash(obj, [...excludeKeys, 'do_objectID', '$pointer']); | ||
}; | ||
/** | ||
* Helper function that creates a string hash from a set of attributes of a style | ||
* object. | ||
*/ | ||
const styleHash = (style) => objectHash({ | ||
const styleHash = (style) => stableObjectHash({ | ||
borders: style === null || style === void 0 ? void 0 : style.borders, | ||
@@ -29,3 +35,3 @@ borderOptions: style === null || style === void 0 ? void 0 : style.borderOptions, | ||
*/ | ||
const textStyleHash = (style) => objectHash({ | ||
const textStyleHash = (style) => stableObjectHash({ | ||
borders: style === null || style === void 0 ? void 0 : style.borders, | ||
@@ -37,3 +43,3 @@ borderOptions: style === null || style === void 0 ? void 0 : style.borderOptions, | ||
innerShadows: style === null || style === void 0 ? void 0 : style.innerShadows, | ||
textStyle: style && style.textStyle ? objectHash(style === null || style === void 0 ? void 0 : style.textStyle) : null, | ||
textStyle: style && style.textStyle ? stableObjectHash(style === null || style === void 0 ? void 0 : style.textStyle) : null, | ||
}); | ||
@@ -168,5 +174,3 @@ /** | ||
nodeToObject, | ||
objectHash(obj, excludeKeys = []) { | ||
return objectHash(obj, [...excludeKeys, 'do_objectID', '$pointer']); | ||
}, | ||
objectHash: stableObjectHash, | ||
objectsEqual(obj1, obj2, excludeKeys = []) { | ||
@@ -173,0 +177,0 @@ return objectsEqual(obj1, obj2, [...excludeKeys, 'do_objectID', '$pointer']); |
{ | ||
"name": "@sketch-hq/sketch-assistant-utils", | ||
"version": "5.0.0-next.6", | ||
"version": "5.0.0-next.7", | ||
"module": "dist/esm/index", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/index", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
173315
2296