@fileverse-dev/formulajs 4.4.17-fix-sort-fn-5 → 4.4.18
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,7 +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,
|
|
1273
|
+
function SORT(array, sort_index = 1, is_ascending, by_col = false) {
|
|
1274
1274
|
if (!array || !Array.isArray(array)) return na;
|
|
1275
1275
|
if (array.length === 0) return 0;
|
|
1276
1276
|
|
|
@@ -1278,7 +1278,7 @@ function SORT(array, sort_index = 1, isAscending, by_col = false) {
|
|
|
1278
1278
|
if (!idx || idx < 1) return value;
|
|
1279
1279
|
idx = idx - 1;
|
|
1280
1280
|
|
|
1281
|
-
const sortOrderNumber =
|
|
1281
|
+
const sortOrderNumber = is_ascending === 'FALSE' ? -1 : 1;
|
|
1282
1282
|
let order = parseNumber(sortOrderNumber);
|
|
1283
1283
|
if (order !== 1 && order !== -1) return value;
|
|
1284
1284
|
|
package/lib/esm/index.mjs
CHANGED
|
@@ -1268,7 +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,
|
|
1271
|
+
function SORT(array, sort_index = 1, is_ascending, by_col = false) {
|
|
1272
1272
|
if (!array || !Array.isArray(array)) return na;
|
|
1273
1273
|
if (array.length === 0) return 0;
|
|
1274
1274
|
|
|
@@ -1276,7 +1276,7 @@ function SORT(array, sort_index = 1, isAscending, by_col = false) {
|
|
|
1276
1276
|
if (!idx || idx < 1) return value;
|
|
1277
1277
|
idx = idx - 1;
|
|
1278
1278
|
|
|
1279
|
-
const sortOrderNumber =
|
|
1279
|
+
const sortOrderNumber = is_ascending === 'FALSE' ? -1 : 1;
|
|
1280
1280
|
let order = parseNumber(sortOrderNumber);
|
|
1281
1281
|
if (order !== 1 && order !== -1) return value;
|
|
1282
1282
|
|
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: any,
|
|
3809
|
+
export function SORT(array: any, sort_index: any, is_ascending: 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: any,
|
|
3809
|
+
export function SORT(array: any, sort_index: any, is_ascending: any, by_col?: any): any;
|
|
3810
3810
|
/**
|
|
3811
3811
|
* Returns a positive square root.
|
|
3812
3812
|
*
|