@sanity/schema 5.17.0-next.21 → 5.17.0-next.23

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/lib/_internal.js CHANGED
@@ -492,9 +492,9 @@ function maybeOrdering(val) {
492
492
  }
493
493
  function maybeOrderingBy(val) {
494
494
  if (!isObject(val) || Array.isArray(val)) return;
495
- const field = "field" in val && typeof val.field == "string" ? val.field : void 0, direction = "direction" in val && (val.direction === "asc" || val.direction === "desc") ? val.direction : void 0;
495
+ const field = "field" in val && typeof val.field == "string" ? val.field : void 0, direction = "direction" in val && (val.direction === "asc" || val.direction === "desc") ? val.direction : void 0, nulls = "nulls" in val && (val.nulls === "first" || val.nulls === "last") ? val.nulls : void 0;
496
496
  if (!(!field || !direction))
497
- return { field, direction };
497
+ return { field, direction, ...nulls && { nulls } };
498
498
  }
499
499
  function isLessCanonicalName(a, b) {
500
500
  return a.length < b.length || a.length === b.length && a < b;