@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 CHANGED
@@ -3616,12 +3616,18 @@ function hashString(string) {
3616
3616
  return hash.toString(16);
3617
3617
  }
3618
3618
  function sortedJSONStringify(object) {
3619
- const allKeys = /* @__PURE__ */ new Set();
3620
- JSON.stringify(object, (key, value) => {
3621
- allKeys.add(key);
3622
- return value;
3623
- });
3624
- return JSON.stringify(object, Array.from(allKeys).sort());
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));