@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/utils.esm.js
CHANGED
|
@@ -3433,12 +3433,18 @@ function hashString(string) {
|
|
|
3433
3433
|
return hash.toString(16);
|
|
3434
3434
|
}
|
|
3435
3435
|
function sortedJSONStringify(object) {
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3436
|
+
function shouldIncludeValue(value) {
|
|
3437
|
+
return value !== void 0 && typeof value !== "function" && typeof value !== "symbol";
|
|
3438
|
+
}
|
|
3439
|
+
if (Array.isArray(object)) {
|
|
3440
|
+
return `[${object.map((x) => x === void 0 ? "undefined" : sortedJSONStringify(x)).join(",")}]`;
|
|
3441
|
+
}
|
|
3442
|
+
if (object === null || typeof object !== "object") {
|
|
3443
|
+
return JSON.stringify(typeof object === "function" ? null : object);
|
|
3444
|
+
}
|
|
3445
|
+
const record = object;
|
|
3446
|
+
const sortedValues = Object.keys(record).sort().filter((key) => shouldIncludeValue(record[key])).map((key) => `${JSON.stringify(key)}:${sortedJSONStringify(record[key])}`);
|
|
3447
|
+
return `{${sortedValues.join(",")}}`;
|
|
3442
3448
|
}
|
|
3443
3449
|
function hashObject(object) {
|
|
3444
3450
|
return hashString(sortedJSONStringify(object));
|