@react-fabric/utilities 1.0.0-beta.61 → 1.0.0-beta.62

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.
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var _ascii = require('./_ascii.js');
4
+ var _getByPath = require('./_getByPath.js');
4
5
  var _isType = require('./_isType.js');
5
6
 
6
7
  /*
@@ -117,8 +118,8 @@ var compareValues = function compareValues() {
117
118
  var order = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "asc";
118
119
  var key = arguments.length > 1 ? arguments[1] : undefined;
119
120
  return function (a, b) {
120
- var aValue = key && _isType.isObject(a) ? a[key] : a;
121
- var bValue = key && _isType.isObject(b) ? b[key] : b;
121
+ var aValue = key && _isType.isObject(a) ? _getByPath.getByPath(a, key, "") : a;
122
+ var bValue = key && _isType.isObject(b) ? _getByPath.getByPath(b, key, "") : b;
122
123
  var bigger = order === "asc" ? 1 : -1;
123
124
  var smaller = order === "desc" ? 1 : -1;
124
125
  // return 0 when equal, allowing for multiple sorting properties
@@ -1,6 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import { ascii } from './_ascii.js';
4
+ import { getByPath } from './_getByPath.js';
4
5
  import { isNil, isString, isNumber, isBoolean, isObject } from './_isType.js';
5
6
 
6
7
  /*
@@ -117,8 +118,8 @@ var compareValues = function compareValues() {
117
118
  var order = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "asc";
118
119
  var key = arguments.length > 1 ? arguments[1] : undefined;
119
120
  return function (a, b) {
120
- var aValue = key && isObject(a) ? a[key] : a;
121
- var bValue = key && isObject(b) ? b[key] : b;
121
+ var aValue = key && isObject(a) ? getByPath(a, key, "") : a;
122
+ var bValue = key && isObject(b) ? getByPath(b, key, "") : b;
122
123
  var bigger = order === "asc" ? 1 : -1;
123
124
  var smaller = order === "desc" ? 1 : -1;
124
125
  // return 0 when equal, allowing for multiple sorting properties
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-fabric/utilities",
3
- "version": "1.0.0-beta.61",
3
+ "version": "1.0.0-beta.62",
4
4
  "description": "RUF: Utility package",
5
5
  "author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
6
6
  "license": "MIT",
@@ -45,5 +45,5 @@
45
45
  "node": ">=18.12.0",
46
46
  "npm": ">=8.19.0"
47
47
  },
48
- "gitHead": "a0b0c571bf9c189fa3355bbc3b896ecc4b9d6a04"
48
+ "gitHead": "9dce2fd9bb753d67e3f8adbf50be257b4bc64242"
49
49
  }
package/src/_isEqual.ts CHANGED
@@ -22,6 +22,7 @@
22
22
  */
23
23
 
24
24
  import { ascii } from "./_ascii";
25
+ import { getByPath } from "./_getByPath";
25
26
  import { isBoolean, isNil, isNumber, isObject, isString } from "./_isType";
26
27
 
27
28
  /**
@@ -115,8 +116,8 @@ export const matchString = (
115
116
  export const compareValues =
116
117
  (order: "asc" | "desc" = "asc", key?: string) =>
117
118
  (a: unknown, b: unknown) => {
118
- const aValue: string = key && isObject(a) ? a[key] : a;
119
- const bValue: string = key && isObject(b) ? b[key] : b;
119
+ const aValue: any = key && isObject(a) ? getByPath(a, key, "") : a;
120
+ const bValue: any = key && isObject(b) ? getByPath(b, key, "") : b;
120
121
 
121
122
  const bigger = order === "asc" ? 1 : -1;
122
123
  const smaller = order === "desc" ? 1 : -1;