@rjsf/utils 6.7.1 → 6.8.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/dist/index.cjs +12 -6
- package/dist/index.cjs.map +2 -2
- package/dist/utils.esm.js +12 -6
- package/dist/utils.esm.js.map +2 -2
- package/dist/utils.umd.js +12 -6
- package/lib/hashForSchema.d.ts +2 -1
- package/lib/hashForSchema.js +17 -8
- package/lib/hashForSchema.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/hashForSchema.ts +19 -8
package/dist/index.cjs
CHANGED
|
@@ -3616,12 +3616,18 @@ function hashString(string) {
|
|
|
3616
3616
|
return hash.toString(16);
|
|
3617
3617
|
}
|
|
3618
3618
|
function sortedJSONStringify(object) {
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3619
|
+
function shouldIncludeValue(value) {
|
|
3620
|
+
return value !== void 0 && typeof value !== "function" && typeof value !== "symbol";
|
|
3621
|
+
}
|
|
3622
|
+
if (Array.isArray(object)) {
|
|
3623
|
+
return `[${object.map((x) => x === void 0 ? "undefined" : sortedJSONStringify(x)).join(",")}]`;
|
|
3624
|
+
}
|
|
3625
|
+
if (object === null || typeof object !== "object") {
|
|
3626
|
+
return JSON.stringify(typeof object === "function" ? null : object);
|
|
3627
|
+
}
|
|
3628
|
+
const record = object;
|
|
3629
|
+
const sortedValues = Object.keys(record).sort().filter((key) => shouldIncludeValue(record[key])).map((key) => `${JSON.stringify(key)}:${sortedJSONStringify(record[key])}`);
|
|
3630
|
+
return `{${sortedValues.join(",")}}`;
|
|
3625
3631
|
}
|
|
3626
3632
|
function hashObject(object) {
|
|
3627
3633
|
return hashString(sortedJSONStringify(object));
|