@fileverse-dev/formulajs 4.4.17-fix-sort-fn-4 → 4.4.17-fix-sort-fn-5
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/cjs/index.cjs
CHANGED
|
@@ -1270,8 +1270,7 @@ function ROWS(array) {
|
|
|
1270
1270
|
* @param {*} by_col Optional. A logical value indicating the desired sort direction; FALSE to sort by row (default), TRUE to sort by column
|
|
1271
1271
|
* @returns
|
|
1272
1272
|
*/
|
|
1273
|
-
function SORT(array, sort_index = 1,
|
|
1274
|
-
console.log("SORT function called with arguments:", { array, sort_index, sort_order, by_col });
|
|
1273
|
+
function SORT(array, sort_index = 1, isAscending, by_col = false) {
|
|
1275
1274
|
if (!array || !Array.isArray(array)) return na;
|
|
1276
1275
|
if (array.length === 0) return 0;
|
|
1277
1276
|
|
|
@@ -1279,7 +1278,8 @@ function SORT(array, sort_index = 1, sort_order = 1, by_col = false) {
|
|
|
1279
1278
|
if (!idx || idx < 1) return value;
|
|
1280
1279
|
idx = idx - 1;
|
|
1281
1280
|
|
|
1282
|
-
|
|
1281
|
+
const sortOrderNumber = isAscending === 'FALSE' ? -1 : 1;
|
|
1282
|
+
let order = parseNumber(sortOrderNumber);
|
|
1283
1283
|
if (order !== 1 && order !== -1) return value;
|
|
1284
1284
|
|
|
1285
1285
|
const byCol = parseBool(by_col);
|
|
@@ -1335,11 +1335,7 @@ function SORT(array, sort_index = 1, sort_order = 1, by_col = false) {
|
|
|
1335
1335
|
});
|
|
1336
1336
|
|
|
1337
1337
|
const sorted = decorated.map((d) => d.row);
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
console.log("SORT result:", xxxxxx);
|
|
1341
|
-
|
|
1342
|
-
return xxxxxx;
|
|
1338
|
+
return byCol ? transpose(sorted) : sorted;
|
|
1343
1339
|
}
|
|
1344
1340
|
|
|
1345
1341
|
|
package/lib/esm/index.mjs
CHANGED
|
@@ -1268,8 +1268,7 @@ function ROWS(array) {
|
|
|
1268
1268
|
* @param {*} by_col Optional. A logical value indicating the desired sort direction; FALSE to sort by row (default), TRUE to sort by column
|
|
1269
1269
|
* @returns
|
|
1270
1270
|
*/
|
|
1271
|
-
function SORT(array, sort_index = 1,
|
|
1272
|
-
console.log("SORT function called with arguments:", { array, sort_index, sort_order, by_col });
|
|
1271
|
+
function SORT(array, sort_index = 1, isAscending, by_col = false) {
|
|
1273
1272
|
if (!array || !Array.isArray(array)) return na;
|
|
1274
1273
|
if (array.length === 0) return 0;
|
|
1275
1274
|
|
|
@@ -1277,7 +1276,8 @@ function SORT(array, sort_index = 1, sort_order = 1, by_col = false) {
|
|
|
1277
1276
|
if (!idx || idx < 1) return value;
|
|
1278
1277
|
idx = idx - 1;
|
|
1279
1278
|
|
|
1280
|
-
|
|
1279
|
+
const sortOrderNumber = isAscending === 'FALSE' ? -1 : 1;
|
|
1280
|
+
let order = parseNumber(sortOrderNumber);
|
|
1281
1281
|
if (order !== 1 && order !== -1) return value;
|
|
1282
1282
|
|
|
1283
1283
|
const byCol = parseBool(by_col);
|
|
@@ -1333,11 +1333,7 @@ function SORT(array, sort_index = 1, sort_order = 1, by_col = false) {
|
|
|
1333
1333
|
});
|
|
1334
1334
|
|
|
1335
1335
|
const sorted = decorated.map((d) => d.row);
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
console.log("SORT result:", xxxxxx);
|
|
1339
|
-
|
|
1340
|
-
return xxxxxx;
|
|
1336
|
+
return byCol ? transpose(sorted) : sorted;
|
|
1341
1337
|
}
|
|
1342
1338
|
|
|
1343
1339
|
|
package/package.json
CHANGED
package/types/cjs/index.d.cts
CHANGED
|
@@ -3806,7 +3806,7 @@ export function SMARTCONTRACT(...args: any[]): Promise<any>;
|
|
|
3806
3806
|
* @param {*} by_col Optional. A logical value indicating the desired sort direction; FALSE to sort by row (default), TRUE to sort by column
|
|
3807
3807
|
* @returns
|
|
3808
3808
|
*/
|
|
3809
|
-
export function SORT(array: any, sort_index
|
|
3809
|
+
export function SORT(array: any, sort_index: any, isAscending: any, by_col?: any): any;
|
|
3810
3810
|
/**
|
|
3811
3811
|
* Returns a positive square root.
|
|
3812
3812
|
*
|
package/types/esm/index.d.mts
CHANGED
|
@@ -3806,7 +3806,7 @@ export function SMARTCONTRACT(...args: any[]): Promise<any>;
|
|
|
3806
3806
|
* @param {*} by_col Optional. A logical value indicating the desired sort direction; FALSE to sort by row (default), TRUE to sort by column
|
|
3807
3807
|
* @returns
|
|
3808
3808
|
*/
|
|
3809
|
-
export function SORT(array: any, sort_index
|
|
3809
|
+
export function SORT(array: any, sort_index: any, isAscending: any, by_col?: any): any;
|
|
3810
3810
|
/**
|
|
3811
3811
|
* Returns a positive square root.
|
|
3812
3812
|
*
|