@fileverse-dev/formulajs 4.4.20-mod-7 → 4.4.21-price-and-wallet-1

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
@@ -1443,69 +1443,60 @@ function VLOOKUP(lookup_value, table_array, col_index_num, range_lookup) {
1443
1443
 
1444
1444
  function XLOOKUP(search_key, lookup_range, result_range, isColV, missing_value,match_mode, search_mode) {
1445
1445
  let isCol = isColV === "true" ? true : false;
1446
-
1447
- console.log('XLOOKUP parameters:', { search_key, lookup_range, result_range, missing_value, match_mode, search_mode, isCol });
1448
1446
 
1449
1447
  // Validate required parameters
1450
1448
  if (search_key === undefined || search_key === null) {
1451
- console.log('Error: search_key is required');
1452
- return new Error('Error: search_key is required')
1449
+ return new Error('search_key')
1453
1450
  }
1454
1451
 
1455
- if (!lookup_range || !result_range) {
1456
- console.log('Error: lookup_range and result_range are required');
1457
- return new Error('Error: lookup_range and result_range are required')
1452
+ if (!lookup_range) {
1453
+ return new Error('lookup_range')
1454
+ }
1455
+ if (!result_range) {
1456
+ return new Error('result_range')
1458
1457
  }
1459
1458
 
1460
1459
  // Validate and normalize lookup_range (must be singular row or column)
1461
1460
  let lookup_array = normalizeLookupRange(lookup_range);
1462
1461
  if (!lookup_array) {
1463
- console.log('Error: lookup_range must be a singular row or column');
1464
- return new Error('Error: lookup_range must be a singular row or column')
1462
+ return new Error('lookup_range_single')
1465
1463
  }
1466
1464
 
1467
1465
  // Validate and normalize result_range
1468
1466
  let result_array = normalizeResultRange(result_range);
1469
1467
  if (!result_array) {
1470
- console.log('Error: Invalid result_range');
1471
- return new Error('Error: Invalid result_range')
1468
+ return new Error('result_range_invalid')
1472
1469
  }
1473
1470
 
1474
1471
  // Validate that lookup and result ranges have compatible dimensions
1475
1472
  // Exception: if result_range is a single row, it can be returned regardless of lookup_range length
1476
1473
  result_array.map((row) => {
1477
1474
  if (row.length !== lookup_array.length) {
1478
- console.log('Error: lookup_range and result_range must have the same number of columns');
1479
- return new Error('Error: lookup_range and result_range must have the same number of columns/rows')
1475
+ return new Error('lookup_range_and_result_range')
1480
1476
  }
1481
1477
  });
1482
1478
 
1483
- // Set default parameter values
1484
- missing_value = missing_value !== undefined ? missing_value : new Error("Error: Didn't find value in XLOOKUP evaluation");
1479
+ // Set default parameter values Error: Didn't find value in XLOOKUP evaluation
1480
+ missing_value = missing_value !== undefined ? missing_value : new Error("not_found");
1485
1481
  match_mode = match_mode !== undefined ? match_mode : 0;
1486
1482
  search_mode = search_mode !== undefined ? search_mode : 1;
1487
1483
  isCol = isCol !== undefined ? isCol : false;
1488
1484
 
1489
1485
  // Validate match_mode
1490
1486
  if (![0, 1, -1, 2].includes(match_mode)) {
1491
- console.log('Error: match_mode must be 0, 1, -1, or 2');
1492
- return new Error('Error: match_mode must be 0, 1, -1, or 2')
1487
+ return new Error('match_mode_must')
1493
1488
  }
1494
1489
 
1495
1490
  // Validate search_mode
1496
1491
  if (![1, -1, 2, -2].includes(search_mode)) {
1497
- console.log('Error: search_mode must be 1, -1, 2, or -2');
1498
- return new Error('Error: search_mode must be 1, -1, 2, or -2')
1492
+ return new Error('search_mode_must')
1499
1493
  }
1500
1494
 
1501
1495
  // Validate binary search requirements
1502
1496
  if (Math.abs(search_mode) === 2 && match_mode === 2) {
1503
- console.log('Error: Binary search (search_mode ±2) cannot be used with wildcard matching (match_mode 2)');
1504
- return new Error('Error: Binary search (search_mode ±2) cannot be used with wildcard matching (match_mode 2)')
1497
+ return new Error('binary_search_and_wildcard')
1505
1498
  }
1506
-
1507
- console.log('Normalized arrays:', { lookup_array, result_array });
1508
-
1499
+
1509
1500
  let res = performLookup(search_key, lookup_array, result_array, missing_value, match_mode, search_mode, isCol);
1510
1501
  res = isCol ? Array.isArray(res)?res.map((item) => [item.toString()]):res : [res];
1511
1502
  return res
@@ -1552,9 +1543,7 @@ function normalizeResultRange(result_range) {
1552
1543
  }
1553
1544
 
1554
1545
  function performLookup(search_key, lookup_array, result_array, missing_value, match_mode, search_mode, isCol) {
1555
-
1556
- console.log('performLookup called with:', { search_key, lookup_array, result_array, missing_value, match_mode, search_mode, isCol });
1557
-
1546
+
1558
1547
  let foundIndex = -1;
1559
1548
 
1560
1549
  // Handle different match modes
@@ -1603,7 +1592,6 @@ function findExactMatch(search_key, lookup_array, search_mode) {
1603
1592
  const processedValue = typeof value === 'string' ? value.toLowerCase().trim() : value;
1604
1593
 
1605
1594
  if (processedValue === processedSearchKey) {
1606
- console.log(`Exact match found at index ${i}:`, value);
1607
1595
  return i
1608
1596
  }
1609
1597
  }
@@ -1705,7 +1693,6 @@ function findWildcardMatch(search_key, lookup_array, search_mode) {
1705
1693
  for (const i of indices) {
1706
1694
  const value = lookup_array[i];
1707
1695
  if (typeof value === 'string' && regex.test(value)) {
1708
- console.log(`Wildcard match found at index ${i}:`, value);
1709
1696
  return i
1710
1697
  }
1711
1698
  }
@@ -924,6 +924,75 @@ var DUNESIM_metadata = {
924
924
  ]
925
925
  };
926
926
 
927
+ // src/crypto/price/metadata.js
928
+ var PRICE_metadata = {
929
+ n: "PRICE",
930
+ t: 20,
931
+ d: "Query prices of crypto assets",
932
+ r: "Query prices of crypto assets.",
933
+ p: [
934
+ {
935
+ name: "input1",
936
+ detail: "Token address or comma separated coin symbols",
937
+ example: '"btc,eth"',
938
+ require: "m",
939
+ type: "string"
940
+ },
941
+ {
942
+ name: "input2",
943
+ detail: "Single chain for token addresses, Comma separated timeframe in hours for coin symbol. Optional for coin symbols",
944
+ example: '"720,1,24"',
945
+ require: "o",
946
+ type: "string"
947
+ },
948
+ {
949
+ name: "input3",
950
+ detail: "Comma separated timeframe for token address, Skip for coin symbol",
951
+ example: '"720,1,24"',
952
+ require: "o",
953
+ type: "any"
954
+ }
955
+ ]
956
+ };
957
+
958
+ // src/crypto/wallet/metadata.js
959
+ var WALLET_metadata = {
960
+ n: "WALLET",
961
+ t: 20,
962
+ d: "Query wallet balance and transactions",
963
+ r: "Query wallet balance and transactions",
964
+ p: [
965
+ {
966
+ name: "addresses",
967
+ detail: "Comma separated addresses / ens",
968
+ example: '"vitalik.eth", "0xfA0253943c3FF0e43898cba5A7a0dA9D17C27995"',
969
+ require: "m",
970
+ type: "string"
971
+ },
972
+ {
973
+ name: "chain",
974
+ detail: "Comma separated chains",
975
+ example: '"ethereum, base"',
976
+ require: "m",
977
+ type: "any"
978
+ },
979
+ {
980
+ name: "query",
981
+ detail: 'Type of query, can be "txns" or "balance" ',
982
+ example: '"balance"',
983
+ require: "m",
984
+ type: "string"
985
+ },
986
+ {
987
+ name: "timeframe",
988
+ detail: "Comma separated timeframe in hours",
989
+ example: '"17520"',
990
+ require: "m",
991
+ type: "string"
992
+ }
993
+ ]
994
+ };
995
+
927
996
  // src/crypto/crypto-metadata.js
928
997
  var FUNCTION_LOCALE = [
929
998
  EOA_metadata,
@@ -944,6 +1013,8 @@ var FUNCTION_LOCALE = [
944
1013
  SMARTCONTRACT_metadata,
945
1014
  TALLY_metadata,
946
1015
  DUNESIM_metadata,
1016
+ PRICE_metadata,
1017
+ WALLET_metadata,
947
1018
  // GNOSISPAY_metadata,
948
1019
  {
949
1020
  LOGO: "https://raw.githubusercontent.com/mritunjayz/github-storage/refs/heads/main/ploymarket.png",
package/lib/esm/index.mjs CHANGED
@@ -1441,69 +1441,60 @@ function VLOOKUP(lookup_value, table_array, col_index_num, range_lookup) {
1441
1441
 
1442
1442
  function XLOOKUP(search_key, lookup_range, result_range, isColV, missing_value,match_mode, search_mode) {
1443
1443
  let isCol = isColV === "true" ? true : false;
1444
-
1445
- console.log('XLOOKUP parameters:', { search_key, lookup_range, result_range, missing_value, match_mode, search_mode, isCol });
1446
1444
 
1447
1445
  // Validate required parameters
1448
1446
  if (search_key === undefined || search_key === null) {
1449
- console.log('Error: search_key is required');
1450
- return new Error('Error: search_key is required')
1447
+ return new Error('search_key')
1451
1448
  }
1452
1449
 
1453
- if (!lookup_range || !result_range) {
1454
- console.log('Error: lookup_range and result_range are required');
1455
- return new Error('Error: lookup_range and result_range are required')
1450
+ if (!lookup_range) {
1451
+ return new Error('lookup_range')
1452
+ }
1453
+ if (!result_range) {
1454
+ return new Error('result_range')
1456
1455
  }
1457
1456
 
1458
1457
  // Validate and normalize lookup_range (must be singular row or column)
1459
1458
  let lookup_array = normalizeLookupRange(lookup_range);
1460
1459
  if (!lookup_array) {
1461
- console.log('Error: lookup_range must be a singular row or column');
1462
- return new Error('Error: lookup_range must be a singular row or column')
1460
+ return new Error('lookup_range_single')
1463
1461
  }
1464
1462
 
1465
1463
  // Validate and normalize result_range
1466
1464
  let result_array = normalizeResultRange(result_range);
1467
1465
  if (!result_array) {
1468
- console.log('Error: Invalid result_range');
1469
- return new Error('Error: Invalid result_range')
1466
+ return new Error('result_range_invalid')
1470
1467
  }
1471
1468
 
1472
1469
  // Validate that lookup and result ranges have compatible dimensions
1473
1470
  // Exception: if result_range is a single row, it can be returned regardless of lookup_range length
1474
1471
  result_array.map((row) => {
1475
1472
  if (row.length !== lookup_array.length) {
1476
- console.log('Error: lookup_range and result_range must have the same number of columns');
1477
- return new Error('Error: lookup_range and result_range must have the same number of columns/rows')
1473
+ return new Error('lookup_range_and_result_range')
1478
1474
  }
1479
1475
  });
1480
1476
 
1481
- // Set default parameter values
1482
- missing_value = missing_value !== undefined ? missing_value : new Error("Error: Didn't find value in XLOOKUP evaluation");
1477
+ // Set default parameter values Error: Didn't find value in XLOOKUP evaluation
1478
+ missing_value = missing_value !== undefined ? missing_value : new Error("not_found");
1483
1479
  match_mode = match_mode !== undefined ? match_mode : 0;
1484
1480
  search_mode = search_mode !== undefined ? search_mode : 1;
1485
1481
  isCol = isCol !== undefined ? isCol : false;
1486
1482
 
1487
1483
  // Validate match_mode
1488
1484
  if (![0, 1, -1, 2].includes(match_mode)) {
1489
- console.log('Error: match_mode must be 0, 1, -1, or 2');
1490
- return new Error('Error: match_mode must be 0, 1, -1, or 2')
1485
+ return new Error('match_mode_must')
1491
1486
  }
1492
1487
 
1493
1488
  // Validate search_mode
1494
1489
  if (![1, -1, 2, -2].includes(search_mode)) {
1495
- console.log('Error: search_mode must be 1, -1, 2, or -2');
1496
- return new Error('Error: search_mode must be 1, -1, 2, or -2')
1490
+ return new Error('search_mode_must')
1497
1491
  }
1498
1492
 
1499
1493
  // Validate binary search requirements
1500
1494
  if (Math.abs(search_mode) === 2 && match_mode === 2) {
1501
- console.log('Error: Binary search (search_mode ±2) cannot be used with wildcard matching (match_mode 2)');
1502
- return new Error('Error: Binary search (search_mode ±2) cannot be used with wildcard matching (match_mode 2)')
1495
+ return new Error('binary_search_and_wildcard')
1503
1496
  }
1504
-
1505
- console.log('Normalized arrays:', { lookup_array, result_array });
1506
-
1497
+
1507
1498
  let res = performLookup(search_key, lookup_array, result_array, missing_value, match_mode, search_mode, isCol);
1508
1499
  res = isCol ? Array.isArray(res)?res.map((item) => [item.toString()]):res : [res];
1509
1500
  return res
@@ -1550,9 +1541,7 @@ function normalizeResultRange(result_range) {
1550
1541
  }
1551
1542
 
1552
1543
  function performLookup(search_key, lookup_array, result_array, missing_value, match_mode, search_mode, isCol) {
1553
-
1554
- console.log('performLookup called with:', { search_key, lookup_array, result_array, missing_value, match_mode, search_mode, isCol });
1555
-
1544
+
1556
1545
  let foundIndex = -1;
1557
1546
 
1558
1547
  // Handle different match modes
@@ -1601,7 +1590,6 @@ function findExactMatch(search_key, lookup_array, search_mode) {
1601
1590
  const processedValue = typeof value === 'string' ? value.toLowerCase().trim() : value;
1602
1591
 
1603
1592
  if (processedValue === processedSearchKey) {
1604
- console.log(`Exact match found at index ${i}:`, value);
1605
1593
  return i
1606
1594
  }
1607
1595
  }
@@ -1703,7 +1691,6 @@ function findWildcardMatch(search_key, lookup_array, search_mode) {
1703
1691
  for (const i of indices) {
1704
1692
  const value = lookup_array[i];
1705
1693
  if (typeof value === 'string' && regex.test(value)) {
1706
- console.log(`Wildcard match found at index ${i}:`, value);
1707
1694
  return i
1708
1695
  }
1709
1696
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/formulajs",
3
- "version": "4.4.20-mod-7",
3
+ "version": "4.4.21-price-and-wallet-1",
4
4
  "description": "JavaScript implementation of most Microsoft Excel formula functions",
5
5
  "author": "Formulajs",
6
6
  "publishConfig": {