@fileverse-dev/formulajs 4.4.11-mod-18-patch-20 → 4.4.11-mod-21-patch-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/esm/index.mjs CHANGED
@@ -71,9 +71,17 @@ function dateToSerial(date) {
71
71
  return Math.ceil((date - d1900) / 86400000) + addOn
72
72
  }
73
73
 
74
+ function formatDate(date) {
75
+ const day = String(date.getDate()).padStart(2, '0');
76
+ const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are 0-indexed
77
+ const year = date.getFullYear();
78
+ return `${day}/${month}/${year}`
79
+ }
80
+
74
81
  var date = /*#__PURE__*/Object.freeze({
75
82
  __proto__: null,
76
83
  dateToSerial: dateToSerial,
84
+ formatDate: formatDate,
77
85
  get returnSerial () { return returnSerial; },
78
86
  serialToDate: serialToDate,
79
87
  useDate: useDate,
@@ -547,10 +555,46 @@ function parseDate(date) {
547
555
  }
548
556
 
549
557
  if (typeof date === 'string') {
550
- date = /(\d{4})-(\d\d?)-(\d\d?)$/.test(date) ? new Date(date + 'T00:00:00.000') : new Date(date);
558
+ // Check for YYYY-MM-DD (ISO format)
559
+ if (/^\d{4}-\d{1,2}-\d{1,2}$/.test(date)) {
560
+ return new Date(date + 'T00:00:00.000')
561
+ }
562
+
563
+ // Check for DD/MM/YYYY
564
+ const match = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(date);
565
+ if (match) {
566
+ const [, day, month, year] = match.map(Number);
567
+ const d = new Date(year, month - 1, day);
568
+ if (!isNaN(d)) {
569
+ return d
570
+ }
571
+ }
551
572
 
552
- if (!isNaN(date)) {
553
- return date
573
+ // Handle time-only string (HH:MM[:SS])
574
+ if (/^\d{1,2}:\d{2}(:\d{2})?$/.test(date)) {
575
+ const [h, m, s = '0'] = date.split(':').map(Number);
576
+ const now = new Date();
577
+ now.setHours(h, m, s, 0);
578
+ return now
579
+ }
580
+
581
+ // Handle AM/PM time format (e.g., "2:15 PM")
582
+ const ampmMatch = /^(\d{1,2}):(\d{2})\s*(AM|PM)$/i.exec(date);
583
+ if (ampmMatch) {
584
+ let [, hour, minute, meridian] = ampmMatch;
585
+ hour = parseInt(hour);
586
+ minute = parseInt(minute);
587
+ if (meridian.toUpperCase() === 'PM' && hour !== 12) hour += 12;
588
+ if (meridian.toUpperCase() === 'AM' && hour === 12) hour = 0;
589
+ const now = new Date();
590
+ now.setHours(hour, minute, 0, 0);
591
+ return now
592
+ }
593
+
594
+ // Fallback for other date strings
595
+ const parsed = new Date(date);
596
+ if (!isNaN(parsed)) {
597
+ return parsed
554
598
  }
555
599
  }
556
600
 
@@ -5249,7 +5293,6 @@ function PNL() {
5249
5293
  }
5250
5294
 
5251
5295
 
5252
-
5253
5296
  /**
5254
5297
  * Returns the absolute value of a number.
5255
5298
  *
@@ -6944,8 +6987,6 @@ function SUBTOTAL(function_num, ref1) {
6944
6987
  function SUM() {
6945
6988
  let result = 0;
6946
6989
 
6947
- console.log("LLLLO", argsToArray(arguments), {arguments});
6948
-
6949
6990
  arrayEach(argsToArray(arguments), (value) => {
6950
6991
  if (result instanceof Error) {
6951
6992
  return false
@@ -7825,7 +7866,8 @@ function DAYS(end_date, start_date) {
7825
7866
  return start_date
7826
7867
  }
7827
7868
 
7828
- return dateToSerial(startOfDay(end_date)) - dateToSerial(startOfDay(start_date))
7869
+ const diffMs = startOfDay(end_date).getTime() - startOfDay(start_date).getTime();
7870
+ return diffMs / (1000 * 60 * 60 * 24);
7829
7871
  }
7830
7872
 
7831
7873
  /**
@@ -8140,6 +8182,8 @@ NETWORKDAYS.INTL = (start_date, end_date, weekend, holidays) => {
8140
8182
  return total
8141
8183
  };
8142
8184
 
8185
+ const NETWORKDAYS_INTL = NETWORKDAYS.INTL;
8186
+
8143
8187
  /**
8144
8188
  * Returns the serial number of the current date and time.
8145
8189
  *
@@ -8192,9 +8236,14 @@ function TIME(hour, minute, second) {
8192
8236
  return num
8193
8237
  }
8194
8238
 
8195
- return (3600 * hour + 60 * minute + second) / 86400
8239
+ const hh = String(hour).padStart(2, '0');
8240
+ const mm = String(minute).padStart(2, '0');
8241
+ const ss = String(second).padStart(2, '0');
8242
+
8243
+ return `${hh}:${mm}:${ss}`
8196
8244
  }
8197
8245
 
8246
+
8198
8247
  /**
8199
8248
  * Converts a time in the form of text to a serial number.
8200
8249
  *
@@ -8222,7 +8271,7 @@ function TIMEVALUE(time_text) {
8222
8271
  */
8223
8272
  function TODAY() {
8224
8273
  const today = startOfDay(new Date());
8225
- return returnSerial ? dateToSerial(today) : today
8274
+ return formatDate(today)
8226
8275
  }
8227
8276
 
8228
8277
  /**
@@ -8296,6 +8345,11 @@ function WORKDAY(start_date, days, holidays) {
8296
8345
  return WORKDAY.INTL(start_date, days, 1, holidays)
8297
8346
  }
8298
8347
 
8348
+ function ISDATE(value) {
8349
+ const parsed = parseDate(value);
8350
+ return !(parsed instanceof Error)
8351
+ }
8352
+
8299
8353
  /**
8300
8354
  * Returns the serial number of the date before or after a specified number of workdays using parameters to indicate which and how many days are weekend days.
8301
8355
  *
@@ -8380,9 +8434,11 @@ WORKDAY.INTL = (start_date, days, weekend, holidays) => {
8380
8434
  return value
8381
8435
  }
8382
8436
 
8383
- return start_date
8437
+ return formatDate(start_date)
8384
8438
  };
8385
8439
 
8440
+ const WORKDAY_INTL = WORKDAY.INTL;
8441
+
8386
8442
  /**
8387
8443
  * Converts a serial number to a year.
8388
8444
  *
@@ -13022,18 +13078,18 @@ function SWITCH() {
13022
13078
  const SERVICE_API_KEY = {
13023
13079
  Etherscan: "ETHERSCAN_API_KEY",
13024
13080
  Coingecko: "COINGECKO_API_KEY",
13025
- Safe: "SAFE_API_KEY",
13026
13081
  };
13027
13082
 
13028
13083
  const CHAIN_ID_MAP = {
13029
- ethereum: 1,
13030
- gnosis: 100,
13031
- base: 8453,
13032
- };
13084
+ ethereum: 1,
13085
+ gnosis: 100,
13086
+ base: 8453,
13087
+ };
13033
13088
 
13034
- const SAFE_CHAIN_MAP = {
13035
- ethereum: 'eth',
13036
- gnosis: 'gno',
13089
+ const ERROR_MESSAGES_FLAG = {
13090
+ INVALID_API_KEY: '_MISSING',
13091
+ RATE_LIMIT: '_RATE_LIMIT_REACHED',
13092
+ DEFAULT: 'FETCH_ERROR'
13037
13093
  };
13038
13094
 
13039
13095
  const fromTimeStampToBlock = async (timestamp, chain, apiKey) => {
@@ -13047,28 +13103,32 @@ if(!timestamp || !chain || !apiKey) return
13047
13103
  };
13048
13104
 
13049
13105
  async function ETHERSCAN(address, page, offset) {
13050
- const API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Etherscan);
13051
- const url = `https://api.etherscan.io/api?module=account&action=txlist&address=${address}&startblock=0&endblock=99999999&page=${page}&offset=${offset}&sort=asc&apikey=${API_KEY}`;
13052
-
13053
- try {
13054
- const response = await fetch(url);
13055
- if (!response.ok) {
13056
- throw new Error(`HTTP error! Status: ${response.status}`)
13057
- }
13058
- const json = await response.json();
13059
- if (json.result.includes("Invalid API Key")) {
13060
- return `${SERVICE_API_KEY.Etherscan}_MISSING`
13061
- }
13062
- /*
13063
- [{blockNumber: '0x1d3d1', timeStamp: '0x5f7e4f', hash: '0x3c3c3c3c', nonce: '0x1',}]
13064
- */
13065
- return json.result;
13066
- } catch (error) {
13067
- return "ERROR IN FETCHING"
13068
- }
13069
- }
13070
-
13071
- async function GETPRICE(token, vs_currencies) {
13106
+ return `${SERVICE_API_KEY.Etherscan}${ERROR_MESSAGES_FLAG.RATE_LIMIT}`
13107
+ // const API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Etherscan);
13108
+ // const url = `https://api.etherscan.io/v2/api?chainid=1&module=account&action=txlist&address=${address}&startblock=0&endblock=99999999&page=${page || 1}&offset=${offset || 10}&sort=asc&apikey=${API_KEY}`
13109
+
13110
+ // try {
13111
+ // const response = await fetch(url)
13112
+ // if (!response.ok) {
13113
+ // throw new Error(`HTTP error! Status: ${response.status}`)
13114
+ // }
13115
+ // const json = await response.json()
13116
+ // if (json.result.includes("Invalid API Key")) {
13117
+ // return `${SERVICE_API_KEY.Etherscan}${ERROR_MESSAGES_FLAG.INVALID_API_KEY}`
13118
+ // }
13119
+ // if(json.result.includes('Max rate limit reached')){
13120
+ // return `${SERVICE_API_KEY.Etherscan}${ERROR_MESSAGES_FLAG.RATE_LIMIT}`
13121
+ // }
13122
+ // /*
13123
+ // [{blockNumber: '0x1d3d1', timeStamp: '0x5f7e4f', hash: '0x3c3c3c3c', nonce: '0x1',}]
13124
+ // */
13125
+ // return json.result;
13126
+ // } catch (error) {
13127
+ // return ERROR_MESSAGES_FLAG.DEFAULT
13128
+ // }
13129
+ }
13130
+
13131
+ async function COINGECKO(token, vs_currencies) {
13072
13132
  const API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Coingecko);
13073
13133
  const url = `https://api.coingecko.com/api/v3/simple/price?vs_currencies=${vs_currencies}&ids=${token}`;
13074
13134
 
@@ -13082,7 +13142,10 @@ async function GETPRICE(token, vs_currencies) {
13082
13142
  if (!response.ok) {
13083
13143
  const json = await response.json();
13084
13144
  if (json.status.error_message.includes("API Key Missing")) {
13085
- return `${SERVICE_API_KEY.Coingecko}_MISSING`
13145
+ return `${SERVICE_API_KEY.Coingecko}${ERROR_MESSAGES_FLAG.INVALID_API_KEY}`
13146
+ }
13147
+ if(response.status === 429){
13148
+ return `${SERVICE_API_KEY.Coingecko}${ERROR_MESSAGES_FLAG.RATE_LIMIT}`
13086
13149
  }
13087
13150
  }
13088
13151
  const jsonResponse = await response.json();
@@ -13101,11 +13164,11 @@ async function GETPRICE(token, vs_currencies) {
13101
13164
  */
13102
13165
  return [output];
13103
13166
  } catch (error) {
13104
- return "ERROR IN FETCHING"
13167
+ return ERROR_MESSAGES_FLAG.DEFAULT
13105
13168
  }
13106
13169
  }
13107
13170
 
13108
- async function OX(address, categories, chain, startTime, endTime) {
13171
+ async function EOA(address, categories, chain, startTime, endTime) {
13109
13172
  const API_KEYS = {
13110
13173
  ethereum: window.localStorage.getItem(SERVICE_API_KEY.Etherscan),
13111
13174
  gnosis: window.localStorage.getItem(SERVICE_API_KEY.Gnosisscan),
@@ -13117,12 +13180,12 @@ async function OX(address, categories, chain, startTime, endTime) {
13117
13180
 
13118
13181
  let action = '';
13119
13182
  if (categories === 'txns') action = 'account.txlist';
13120
- else { action = 'account.balance'; } let timeQuery = '';
13121
- if (!isNaN(startTime) && !isNaN(endTime)) {
13122
- const startBlock = await fromTimeStampToBlock(startTime, chain, apiKey);
13123
- const endBlock = await fromTimeStampToBlock(endTime, chain, apiKey);
13183
+ else {action = 'account.balance';} let timeQuery = '';
13184
+ if(!isNaN(startTime) && !isNaN(endTime)){
13185
+ const startBlock = await fromTimeStampToBlock(startTime, chain, apiKey);
13186
+ const endBlock = await fromTimeStampToBlock(endTime, chain, apiKey);
13124
13187
  timeQuery = `&startblock=${startBlock}&endblock=${endBlock}`;
13125
- } else if (categories === 'balance') {
13188
+ } else if(categories === 'balance') {
13126
13189
  timeQuery = `&tag=latest`;
13127
13190
  } else {
13128
13191
  throw new Error('Start and End Time is required for querying transaction list ')
@@ -13135,56 +13198,28 @@ async function OX(address, categories, chain, startTime, endTime) {
13135
13198
  if (json.result?.includes?.("Invalid API Key")) {
13136
13199
  return `${SERVICE_API_KEY[chain.charAt(0).toUpperCase() + chain.slice(1)]}_MISSING`;
13137
13200
  }
13201
+ if(json.result.includes('Max rate limit reached')){
13202
+ return `${SERVICE_API_KEY.Etherscan}${ERROR_MESSAGES_FLAG.RATE_LIMIT}`
13203
+ }
13138
13204
  return json.result;
13139
13205
  } catch (e) {
13140
13206
  console.log(e);
13141
- return "ERROR IN FETCHING";
13207
+ return ERROR_MESSAGES_FLAG.DEFAULT;
13142
13208
  }
13143
13209
  }
13144
13210
 
13145
13211
 
13212
+
13213
+
13214
+
13146
13215
  async function FLVURL(token, vs_currencies) {
13147
13216
  return new Promise((resolve) => {
13148
13217
  setTimeout(() => {
13149
- resolve([{ "Yoo": "gotcha" }]);
13218
+ resolve([{"Yoo": "gotcha"}]);
13150
13219
  }, 10000);
13151
13220
  });
13152
13221
  }
13153
13222
 
13154
- async function SAFE(address, utility, chain, limit, offset) {
13155
-
13156
- if (typeof limit !== 'number' || limit < 0) return 'INVALID_LIMIT';
13157
- if (typeof offset !== 'number' || offset < 0) return 'INVALID_OFFSET';
13158
- if (utility !== 'txns') return 'UTILITY IS NOT SUPPORTED';
13159
-
13160
- const apiKey = window.localStorage.getItem(SERVICE_API_KEY.Safe);
13161
- const chainIdentifier = SAFE_CHAIN_MAP[chain];
13162
-
13163
- if (!apiKey) return `${SERVICE_API_KEY.Safe}_MISSING`;
13164
- if (!chainIdentifier) return 'CHAIN IS NOT SUPPORTED';
13165
-
13166
- const url = `https://api.safe.global/tx-service/${chainIdentifier}/api/v2/safes/${address}/multisig-transactions?limit=${limit}&offset=${offset}`;
13167
- try {
13168
- const response = await fetch(url,
13169
- {
13170
- headers: {
13171
- 'Authorization': `Bearer ${apiKey}`,
13172
- },
13173
- }
13174
- );
13175
- if (!response.ok) throw new Error(`HTTP error! Status: ${response.status}`);
13176
- const json = await response.json();
13177
- if (!Array.isArray(json.results)) {
13178
- return "INVALID API RESPONSE";
13179
- }
13180
- // remove nested structure from the response
13181
- return json.results.map(({ confirmations, dataDecoded, ...rest }) => rest);
13182
- } catch (e) {
13183
- console.log(e);
13184
- return "ERROR IN FETCHING";
13185
- }
13186
- }
13187
-
13188
13223
  const utils = { errors, symbols, date };
13189
13224
 
13190
- export { ABS, ACCRINT, ACOS, ACOSH, ACOT, ACOTH, AGGREGATE, AND, ARABIC, ASIN, ASINH, ATAN, ATAN2, ATANH, AVEDEV, AVERAGE, AVERAGEA, AVERAGEIF, AVERAGEIFS, BASE, BESSELI, BESSELJ, BESSELK, BESSELY, BETA, BETADIST, BETAINV, BIN2DEC, BIN2HEX, BIN2OCT, BINOM, BINOMDIST, BITAND, BITLSHIFT, BITOR, BITRSHIFT, BITXOR, CEILING, CEILINGMATH, CEILINGPRECISE, CHAR, CHIDIST, CHIDISTRT, CHIINV, CHIINVRT, CHISQ, CHITEST, CHOOSE, CLEAN, CODE, COLUMN, COLUMNS, COMBIN, COMBINA, COMPLEX, CONCAT, CONCATENATE, CONFIDENCE, CONVERT, CORREL, COS, COSH, COT, COTH, COUNT, COUNTA, COUNTBLANK, COUNTIF, COUNTIFS, COUPDAYS, COVAR, COVARIANCE, COVARIANCEP, COVARIANCES, CRITBINOM, CSC, CSCH, CUMIPMT, CUMPRINC, DATE, DATEDIF, DATEVALUE, DAVERAGE, DAY, DAYS, DAYS360, DB, DCOUNT, DCOUNTA, DDB, DEC2BIN, DEC2HEX, DEC2OCT, DECIMAL, DEGREES, DELTA, DEVSQ, DGET, DISC, DMAX, DMIN, DOLLAR, DOLLARDE, DOLLARFR, DPRODUCT, DSTDEV, DSTDEVP, DSUM, DVAR, DVARP, EDATE, EFFECT, EOMONTH, ERF, ERFC, ERFCPRECISE, ERFPRECISE, ERROR, ETHERSCAN, EVEN, EXACT, EXP, EXPON, EXPONDIST, F, FACT, FACTDOUBLE, FALSE, FDIST, FDISTRT, FIND, FINV, FINVRT, FISHER, FISHERINV, FIXED, FLOOR, FLOORMATH, FLOORPRECISE, FLVURL, FORECAST, FREQUENCY, FTEST, FV, FVSCHEDULE, GAMMA, GAMMADIST, GAMMAINV, GAMMALN, GAMMALNPRECISE, GAUSS, GCD, GEOMEAN, GESTEP, GETPRICE, GROWTH, HARMEAN, HEX2BIN, HEX2DEC, HEX2OCT, HLOOKUP, HOUR, HYPGEOM, HYPGEOMDIST, IF, IFERROR, IFNA, IFS, IMABS, IMAGINARY, IMARGUMENT, IMCONJUGATE, IMCOS, IMCOSH, IMCOT, IMCSC, IMCSCH, IMDIV, IMEXP, IMLN, IMLOG10, IMLOG2, IMPOWER, IMPRODUCT, IMREAL, IMSEC, IMSECH, IMSIN, IMSINH, IMSQRT, IMSUB, IMSUM, IMTAN, INDEX, INT, INTERCEPT, IPMT, IRR, ISBLANK, ISERR, ISERROR, ISEVEN, ISLOGICAL, ISNA, ISNONTEXT, ISNUMBER, ISO, ISODD, ISOWEEKNUM, ISPMT, ISTEXT, KURT, LARGE, LCM, LEFT, LEN, LINEST, LN, LOG, LOG10, LOGEST, LOGINV, LOGNORM, LOGNORMDIST, LOGNORMINV, LOOKUP, LOWER, MATCH, MAX, MAXA, MAXIFS, MEDIAN, MID, MIN, MINA, MINIFS, MINUTE, MIRR, MMULT, MOD, MODE, MODEMULT, MODESNGL, MONTH, MROUND, MULTINOMIAL, MUNIT, N, NA, NEGBINOM, NEGBINOMDIST, NETWORKDAYS, NETWORKDAYSINTL, NOMINAL, NORM, NORMDIST, NORMINV, NORMSDIST, NORMSINV, NOT, NOW, NPER, NPV, NUMBERVALUE, OCT2BIN, OCT2DEC, OCT2HEX, ODD, OR, OX, PDURATION, PEARSON, PERCENTILE, PERCENTILEEXC, PERCENTILEINC, PERCENTRANK, PERCENTRANKEXC, PERCENTRANKINC, PERMUT, PERMUTATIONA, PHI, PI, PMT, PNL, POISSON, POISSONDIST, POWER, PPMT, PRICEDISC, PROB, PRODUCT, PROPER, PV, QUARTILE, QUARTILEEXC, QUARTILEINC, QUOTIENT, RADIANS, RAND, RANDBETWEEN, RANK, RANKAVG, RANKEQ, RATE, REPLACE, REPT, RIGHT, ROMAN, ROUND, ROUNDDOWN, ROUNDUP, ROW, ROWS, RRI, RSQ, SAFE, SEARCH, SEC, SECH, SECOND, SERIESSUM, SIGN, SIN, SINH, SKEW, SKEWP, SLN, SLOPE, SMALL, SORT, SQRT, SQRTPI, STANDARDIZE, STDEV, STDEVA, STDEVP, STDEVPA, STDEVS, STEYX, SUBSTITUTE, SUBTOTAL, SUM, SUMIF, SUMIFS, SUMPRODUCT, SUMSQ, SUMX2MY2, SUMX2PY2, SUMXMY2, SWITCH, SYD, T, TAN, TANH, TBILLEQ, TBILLPRICE, TBILLYIELD, TDIST, TDISTRT, TEXT, TEXTJOIN, TIME, TIMEVALUE, TINV, TODAY, TRANSPOSE, TREND, TRIM, TRIMMEAN, TRUE, TRUNC, TTEST, TYPE, UNICHAR, UNICODE, UNIQUE, UPPER, VALUE, VAR, VARA, VARP, VARPA, VARS, VLOOKUP, WEEKDAY, WEEKNUM, WEIBULL, WEIBULLDIST, WORKDAY, WORKDAYINTL, XIRR, XNPV, XOR, YEAR, YEARFRAC, Z, ZTEST, utils };
13225
+ export { ABS, ACCRINT, ACOS, ACOSH, ACOT, ACOTH, AGGREGATE, AND, ARABIC, ASIN, ASINH, ATAN, ATAN2, ATANH, AVEDEV, AVERAGE, AVERAGEA, AVERAGEIF, AVERAGEIFS, BASE, BESSELI, BESSELJ, BESSELK, BESSELY, BETA, BETADIST, BETAINV, BIN2DEC, BIN2HEX, BIN2OCT, BINOM, BINOMDIST, BITAND, BITLSHIFT, BITOR, BITRSHIFT, BITXOR, CEILING, CEILINGMATH, CEILINGPRECISE, CHAR, CHIDIST, CHIDISTRT, CHIINV, CHIINVRT, CHISQ, CHITEST, CHOOSE, CLEAN, CODE, COINGECKO, COLUMN, COLUMNS, COMBIN, COMBINA, COMPLEX, CONCAT, CONCATENATE, CONFIDENCE, CONVERT, CORREL, COS, COSH, COT, COTH, COUNT, COUNTA, COUNTBLANK, COUNTIF, COUNTIFS, COUPDAYS, COVAR, COVARIANCE, COVARIANCEP, COVARIANCES, CRITBINOM, CSC, CSCH, CUMIPMT, CUMPRINC, DATE, DATEDIF, DATEVALUE, DAVERAGE, DAY, DAYS, DAYS360, DB, DCOUNT, DCOUNTA, DDB, DEC2BIN, DEC2HEX, DEC2OCT, DECIMAL, DEGREES, DELTA, DEVSQ, DGET, DISC, DMAX, DMIN, DOLLAR, DOLLARDE, DOLLARFR, DPRODUCT, DSTDEV, DSTDEVP, DSUM, DVAR, DVARP, EDATE, EFFECT, EOA, EOMONTH, ERF, ERFC, ERFCPRECISE, ERFPRECISE, ERROR, ETHERSCAN, EVEN, EXACT, EXP, EXPON, EXPONDIST, F, FACT, FACTDOUBLE, FALSE, FDIST, FDISTRT, FIND, FINV, FINVRT, FISHER, FISHERINV, FIXED, FLOOR, FLOORMATH, FLOORPRECISE, FLVURL, FORECAST, FREQUENCY, FTEST, FV, FVSCHEDULE, GAMMA, GAMMADIST, GAMMAINV, GAMMALN, GAMMALNPRECISE, GAUSS, GCD, GEOMEAN, GESTEP, GROWTH, HARMEAN, HEX2BIN, HEX2DEC, HEX2OCT, HLOOKUP, HOUR, HYPGEOM, HYPGEOMDIST, IF, IFERROR, IFNA, IFS, IMABS, IMAGINARY, IMARGUMENT, IMCONJUGATE, IMCOS, IMCOSH, IMCOT, IMCSC, IMCSCH, IMDIV, IMEXP, IMLN, IMLOG10, IMLOG2, IMPOWER, IMPRODUCT, IMREAL, IMSEC, IMSECH, IMSIN, IMSINH, IMSQRT, IMSUB, IMSUM, IMTAN, INDEX, INT, INTERCEPT, IPMT, IRR, ISBLANK, ISDATE, ISERR, ISERROR, ISEVEN, ISLOGICAL, ISNA, ISNONTEXT, ISNUMBER, ISO, ISODD, ISOWEEKNUM, ISPMT, ISTEXT, KURT, LARGE, LCM, LEFT, LEN, LINEST, LN, LOG, LOG10, LOGEST, LOGINV, LOGNORM, LOGNORMDIST, LOGNORMINV, LOOKUP, LOWER, MATCH, MAX, MAXA, MAXIFS, MEDIAN, MID, MIN, MINA, MINIFS, MINUTE, MIRR, MMULT, MOD, MODE, MODEMULT, MODESNGL, MONTH, MROUND, MULTINOMIAL, MUNIT, N, NA, NEGBINOM, NEGBINOMDIST, NETWORKDAYS, NETWORKDAYSINTL, NETWORKDAYS_INTL, NOMINAL, NORM, NORMDIST, NORMINV, NORMSDIST, NORMSINV, NOT, NOW, NPER, NPV, NUMBERVALUE, OCT2BIN, OCT2DEC, OCT2HEX, ODD, OR, PDURATION, PEARSON, PERCENTILE, PERCENTILEEXC, PERCENTILEINC, PERCENTRANK, PERCENTRANKEXC, PERCENTRANKINC, PERMUT, PERMUTATIONA, PHI, PI, PMT, PNL, POISSON, POISSONDIST, POWER, PPMT, PRICEDISC, PROB, PRODUCT, PROPER, PV, QUARTILE, QUARTILEEXC, QUARTILEINC, QUOTIENT, RADIANS, RAND, RANDBETWEEN, RANK, RANKAVG, RANKEQ, RATE, REPLACE, REPT, RIGHT, ROMAN, ROUND, ROUNDDOWN, ROUNDUP, ROW, ROWS, RRI, RSQ, SEARCH, SEC, SECH, SECOND, SERIESSUM, SIGN, SIN, SINH, SKEW, SKEWP, SLN, SLOPE, SMALL, SORT, SQRT, SQRTPI, STANDARDIZE, STDEV, STDEVA, STDEVP, STDEVPA, STDEVS, STEYX, SUBSTITUTE, SUBTOTAL, SUM, SUMIF, SUMIFS, SUMPRODUCT, SUMSQ, SUMX2MY2, SUMX2PY2, SUMXMY2, SWITCH, SYD, T, TAN, TANH, TBILLEQ, TBILLPRICE, TBILLYIELD, TDIST, TDISTRT, TEXT, TEXTJOIN, TIME, TIMEVALUE, TINV, TODAY, TRANSPOSE, TREND, TRIM, TRIMMEAN, TRUE, TRUNC, TTEST, TYPE, UNICHAR, UNICODE, UNIQUE, UPPER, VALUE, VAR, VARA, VARP, VARPA, VARS, VLOOKUP, WEEKDAY, WEEKNUM, WEIBULL, WEIBULLDIST, WORKDAY, WORKDAYINTL, WORKDAY_INTL, XIRR, XNPV, XOR, YEAR, YEARFRAC, Z, ZTEST, utils };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/formulajs",
3
- "version": "4.4.11-mod-18-patch-20",
3
+ "version": "4.4.11-mod-21-patch-1",
4
4
  "description": "JavaScript implementation of most Microsoft Excel formula functions",
5
5
  "author": "Formulajs",
6
6
  "publishConfig": {
@@ -624,6 +624,7 @@ export function CLEAN(text: any): any;
624
624
  * @returns
625
625
  */
626
626
  export function CODE(text: any): any;
627
+ export function COINGECKO(token: any, vs_currencies: any): Promise<string | {}[]>;
627
628
  /**
628
629
  * Returns the column number of a reference.
629
630
  *
@@ -993,7 +994,7 @@ export function DAVERAGE(database: any, field: any, criteria: any): number | Err
993
994
  * @param {*} serial_number The date of the day you are trying to find.
994
995
  * @returns
995
996
  */
996
- export function DAY(serial_number: any): any;
997
+ export function DAY(serial_number: any): number | Error;
997
998
  /**
998
999
  * Returns the number of days between two dates.
999
1000
  *
@@ -1293,6 +1294,7 @@ export function EDATE(start_date: any, months: any): any;
1293
1294
  * @returns
1294
1295
  */
1295
1296
  export function EFFECT(nominal_rate: any, npery: any): number | Error;
1297
+ export function EOA(address: any, categories: any, chain: any, startTime: any, endTime: any): Promise<any>;
1296
1298
  /**
1297
1299
  * Returns the serial number of the last day of the month before or after a specified number of months.
1298
1300
  *
@@ -1327,7 +1329,7 @@ export const ERFPRECISE: any;
1327
1329
  export namespace ERROR {
1328
1330
  function TYPE(error_val: any): Error | 1 | 2 | 3 | 4 | 8 | 5 | 6 | 7;
1329
1331
  }
1330
- export function ETHERSCAN(address: any, page: any, offset: any): Promise<any>;
1332
+ export function ETHERSCAN(address: any, page: any, offset: any): Promise<string>;
1331
1333
  /**
1332
1334
  * Rounds a number up to the nearest even integer.
1333
1335
  *
@@ -1786,7 +1788,6 @@ export function GEOMEAN(...args: any[]): any;
1786
1788
  * @returns
1787
1789
  */
1788
1790
  export function GESTEP(number: any, step: any): any;
1789
- export function GETPRICE(token: any, vs_currencies: any): Promise<string | {}[]>;
1790
1791
  /**
1791
1792
  * Returns values along an exponential trend.
1792
1793
  *
@@ -2233,6 +2234,7 @@ export function IRR(values: any, guess: any): any;
2233
2234
  * @returns
2234
2235
  */
2235
2236
  export function ISBLANK(value: any): boolean;
2237
+ export function ISDATE(value: any): boolean;
2236
2238
  /**
2237
2239
  * Returns TRUE if the value is any error value except #N/A.
2238
2240
  *
@@ -2803,6 +2805,18 @@ export namespace NETWORKDAYS {
2803
2805
  * @returns
2804
2806
  */
2805
2807
  export function NETWORKDAYSINTL(start_date: any, end_date: any, weekend: any, holidays: any): number | Error;
2808
+ /**
2809
+ * Returns the number of whole workdays between two dates using parameters to indicate which and how many days are weekend days.
2810
+ *
2811
+ * Category: Date and time
2812
+ *
2813
+ * @param {*} start_date The date for from which the difference is to be computed. The start_date can be earlier than, the same as, or later than the end_date.
2814
+ * @param {*} end_date The date for to which the difference is to be computed.
2815
+ * @param {*} weekend Optional. Indicates the days of the week that are weekend days and are not included in the number of whole working days between start_date and end_date. Weekend is a weekend number or string that specifies when weekends occur. Weekend number values indicate the following weekend days:
2816
+ * @param {*} holidays Optional. An optional set of one or more dates that are to be excluded from the working day calendar. holidays shall be a range of values that contain the dates, or an array constant of the serial values that represent those dates. The ordering of dates or serial values in holidays can be arbitrary.
2817
+ * @returns
2818
+ */
2819
+ export function NETWORKDAYS_INTL(start_date: any, end_date: any, weekend: any, holidays: any): number | Error;
2806
2820
  /**
2807
2821
  * Returns the annual nominal interest rate.
2808
2822
  *
@@ -3001,7 +3015,6 @@ export function ODD(number: any): number | Error;
3001
3015
  * @returns
3002
3016
  */
3003
3017
  export function OR(...args: any[]): any;
3004
- export function OX(address: any, categories: any, chain: any, startTime: any, endTime: any): Promise<any>;
3005
3018
  /**
3006
3019
  * Returns the number of periods required by an investment to reach a specified value.
3007
3020
  *
@@ -3515,7 +3528,6 @@ export function RRI(nper: any, pv: any, fv: any): number | Error;
3515
3528
  * @returns
3516
3529
  */
3517
3530
  export function RSQ(known_y: any, known_x: any): number | Error;
3518
- export function SAFE(address: any, utility: any, chain: any, limit: any, offset: any): Promise<any>;
3519
3531
  /**
3520
3532
  * Finds one text value within another (not case-sensitive)
3521
3533
  *
@@ -4042,7 +4054,7 @@ export function TEXTJOIN(delimiter: any, ignore_empty: any, ...args: any): any;
4042
4054
  * @param {*} second A number from 0 to 32767 representing the second. Any value greater than 59 will be converted to hours, minutes, and seconds. For example, TIME(0,0,2000) = TIME(0,33,22) = .023148 or 12:33:20 AM
4043
4055
  * @returns
4044
4056
  */
4045
- export function TIME(hour: any, minute: any, second: any): number | Error;
4057
+ export function TIME(hour: any, minute: any, second: any): string | Error;
4046
4058
  /**
4047
4059
  * Converts a time in the form of text to a serial number.
4048
4060
  *
@@ -4081,7 +4093,7 @@ export namespace TINV {
4081
4093
  *
4082
4094
  * @returns
4083
4095
  */
4084
- export function TODAY(): number | Date;
4096
+ export function TODAY(): string;
4085
4097
  /**
4086
4098
  * Returns the transpose of an array.
4087
4099
  *
@@ -4326,7 +4338,7 @@ export function WEIBULLDIST(x: any, alpha: any, beta: any, cumulative: any): num
4326
4338
  * @param {*} holidays Optional. An optional list of one or more dates to exclude from the working calendar, such as state and federal holidays and floating holidays. The list can be either a range of values that contain the dates or an array constant of the serial numbers that represent the dates.
4327
4339
  * @returns
4328
4340
  */
4329
- export function WORKDAY(start_date: any, days: any, holidays: any): any;
4341
+ export function WORKDAY(start_date: any, days: any, holidays: any): string | Error;
4330
4342
  export namespace WORKDAY {
4331
4343
  /**
4332
4344
  * Returns the serial number of the date before or after a specified number of workdays using parameters to indicate which and how many days are weekend days.
@@ -4339,7 +4351,7 @@ export namespace WORKDAY {
4339
4351
  * @param {*} holidays Optional. An optional set of one or more dates that are to be excluded from the working day calendar. Holidays shall be a range of values that contain the dates, or an array constant of the serial values that represent those dates. The ordering of dates or serial values in holidays can be arbitrary.
4340
4352
  * @returns
4341
4353
  */
4342
- function INTL(start_date: any, days: any, weekend: any, holidays: any): any;
4354
+ function INTL(start_date: any, days: any, weekend: any, holidays: any): string | Error;
4343
4355
  }
4344
4356
  /**
4345
4357
  * Returns the serial number of the date before or after a specified number of workdays using parameters to indicate which and how many days are weekend days.
@@ -4352,7 +4364,19 @@ export namespace WORKDAY {
4352
4364
  * @param {*} holidays Optional. An optional set of one or more dates that are to be excluded from the working day calendar. Holidays shall be a range of values that contain the dates, or an array constant of the serial values that represent those dates. The ordering of dates or serial values in holidays can be arbitrary.
4353
4365
  * @returns
4354
4366
  */
4355
- export function WORKDAYINTL(start_date: any, days: any, weekend: any, holidays: any): any;
4367
+ export function WORKDAYINTL(start_date: any, days: any, weekend: any, holidays: any): string | Error;
4368
+ /**
4369
+ * Returns the serial number of the date before or after a specified number of workdays using parameters to indicate which and how many days are weekend days.
4370
+ *
4371
+ * Category: Date and time
4372
+ *
4373
+ * @param {*} start_date The start date, truncated to integer.
4374
+ * @param {*} days The number of workdays before or after the start_date. A positive value yields a future date; a negative value yields a past date; a zero value yields the start_date. Day-offset is truncated to an integer.
4375
+ * @param {*} weekend Optional. Indicates the days of the week that are weekend days and are not considered working days. Weekend is a weekend number or string that specifies when weekends occur. Weekend number values indicate the following weekend days:
4376
+ * @param {*} holidays Optional. An optional set of one or more dates that are to be excluded from the working day calendar. Holidays shall be a range of values that contain the dates, or an array constant of the serial values that represent those dates. The ordering of dates or serial values in holidays can be arbitrary.
4377
+ * @returns
4378
+ */
4379
+ export function WORKDAY_INTL(start_date: any, days: any, weekend: any, holidays: any): string | Error;
4356
4380
  /**
4357
4381
  * Returns the internal rate of return for a schedule of cash flows that is not necessarily periodic.
4358
4382
  *
@@ -4462,6 +4486,7 @@ declare var symbols: Readonly<{
4462
4486
  declare var date: Readonly<{
4463
4487
  __proto__: any;
4464
4488
  dateToSerial: typeof dateToSerial;
4489
+ formatDate: typeof formatDate;
4465
4490
  readonly returnSerial: boolean;
4466
4491
  serialToDate: typeof serialToDate;
4467
4492
  useDate: typeof useDate;
@@ -4560,6 +4585,7 @@ declare function NE(value1: any, value2: any, ...args: any[]): boolean | Error;
4560
4585
  */
4561
4586
  declare function POW(base: any, exponent: any, ...args: any[]): any;
4562
4587
  declare function dateToSerial(date: any): number;
4588
+ declare function formatDate(date: any): string;
4563
4589
  declare function serialToDate(serial: any): Date;
4564
4590
  declare function useDate(): void;
4565
4591
  declare function useSerial(): void;
@@ -624,6 +624,7 @@ export function CLEAN(text: any): any;
624
624
  * @returns
625
625
  */
626
626
  export function CODE(text: any): any;
627
+ export function COINGECKO(token: any, vs_currencies: any): Promise<string | {}[]>;
627
628
  /**
628
629
  * Returns the column number of a reference.
629
630
  *
@@ -993,7 +994,7 @@ export function DAVERAGE(database: any, field: any, criteria: any): number | Err
993
994
  * @param {*} serial_number The date of the day you are trying to find.
994
995
  * @returns
995
996
  */
996
- export function DAY(serial_number: any): any;
997
+ export function DAY(serial_number: any): number | Error;
997
998
  /**
998
999
  * Returns the number of days between two dates.
999
1000
  *
@@ -1293,6 +1294,7 @@ export function EDATE(start_date: any, months: any): any;
1293
1294
  * @returns
1294
1295
  */
1295
1296
  export function EFFECT(nominal_rate: any, npery: any): number | Error;
1297
+ export function EOA(address: any, categories: any, chain: any, startTime: any, endTime: any): Promise<any>;
1296
1298
  /**
1297
1299
  * Returns the serial number of the last day of the month before or after a specified number of months.
1298
1300
  *
@@ -1327,7 +1329,7 @@ export const ERFPRECISE: any;
1327
1329
  export namespace ERROR {
1328
1330
  function TYPE(error_val: any): Error | 1 | 2 | 3 | 4 | 8 | 5 | 6 | 7;
1329
1331
  }
1330
- export function ETHERSCAN(address: any, page: any, offset: any): Promise<any>;
1332
+ export function ETHERSCAN(address: any, page: any, offset: any): Promise<string>;
1331
1333
  /**
1332
1334
  * Rounds a number up to the nearest even integer.
1333
1335
  *
@@ -1786,7 +1788,6 @@ export function GEOMEAN(...args: any[]): any;
1786
1788
  * @returns
1787
1789
  */
1788
1790
  export function GESTEP(number: any, step: any): any;
1789
- export function GETPRICE(token: any, vs_currencies: any): Promise<string | {}[]>;
1790
1791
  /**
1791
1792
  * Returns values along an exponential trend.
1792
1793
  *
@@ -2233,6 +2234,7 @@ export function IRR(values: any, guess: any): any;
2233
2234
  * @returns
2234
2235
  */
2235
2236
  export function ISBLANK(value: any): boolean;
2237
+ export function ISDATE(value: any): boolean;
2236
2238
  /**
2237
2239
  * Returns TRUE if the value is any error value except #N/A.
2238
2240
  *
@@ -2803,6 +2805,18 @@ export namespace NETWORKDAYS {
2803
2805
  * @returns
2804
2806
  */
2805
2807
  export function NETWORKDAYSINTL(start_date: any, end_date: any, weekend: any, holidays: any): number | Error;
2808
+ /**
2809
+ * Returns the number of whole workdays between two dates using parameters to indicate which and how many days are weekend days.
2810
+ *
2811
+ * Category: Date and time
2812
+ *
2813
+ * @param {*} start_date The date for from which the difference is to be computed. The start_date can be earlier than, the same as, or later than the end_date.
2814
+ * @param {*} end_date The date for to which the difference is to be computed.
2815
+ * @param {*} weekend Optional. Indicates the days of the week that are weekend days and are not included in the number of whole working days between start_date and end_date. Weekend is a weekend number or string that specifies when weekends occur. Weekend number values indicate the following weekend days:
2816
+ * @param {*} holidays Optional. An optional set of one or more dates that are to be excluded from the working day calendar. holidays shall be a range of values that contain the dates, or an array constant of the serial values that represent those dates. The ordering of dates or serial values in holidays can be arbitrary.
2817
+ * @returns
2818
+ */
2819
+ export function NETWORKDAYS_INTL(start_date: any, end_date: any, weekend: any, holidays: any): number | Error;
2806
2820
  /**
2807
2821
  * Returns the annual nominal interest rate.
2808
2822
  *
@@ -3001,7 +3015,6 @@ export function ODD(number: any): number | Error;
3001
3015
  * @returns
3002
3016
  */
3003
3017
  export function OR(...args: any[]): any;
3004
- export function OX(address: any, categories: any, chain: any, startTime: any, endTime: any): Promise<any>;
3005
3018
  /**
3006
3019
  * Returns the number of periods required by an investment to reach a specified value.
3007
3020
  *
@@ -3515,7 +3528,6 @@ export function RRI(nper: any, pv: any, fv: any): number | Error;
3515
3528
  * @returns
3516
3529
  */
3517
3530
  export function RSQ(known_y: any, known_x: any): number | Error;
3518
- export function SAFE(address: any, utility: any, chain: any, limit: any, offset: any): Promise<any>;
3519
3531
  /**
3520
3532
  * Finds one text value within another (not case-sensitive)
3521
3533
  *
@@ -4042,7 +4054,7 @@ export function TEXTJOIN(delimiter: any, ignore_empty: any, ...args: any): any;
4042
4054
  * @param {*} second A number from 0 to 32767 representing the second. Any value greater than 59 will be converted to hours, minutes, and seconds. For example, TIME(0,0,2000) = TIME(0,33,22) = .023148 or 12:33:20 AM
4043
4055
  * @returns
4044
4056
  */
4045
- export function TIME(hour: any, minute: any, second: any): number | Error;
4057
+ export function TIME(hour: any, minute: any, second: any): string | Error;
4046
4058
  /**
4047
4059
  * Converts a time in the form of text to a serial number.
4048
4060
  *
@@ -4081,7 +4093,7 @@ export namespace TINV {
4081
4093
  *
4082
4094
  * @returns
4083
4095
  */
4084
- export function TODAY(): number | Date;
4096
+ export function TODAY(): string;
4085
4097
  /**
4086
4098
  * Returns the transpose of an array.
4087
4099
  *
@@ -4326,7 +4338,7 @@ export function WEIBULLDIST(x: any, alpha: any, beta: any, cumulative: any): num
4326
4338
  * @param {*} holidays Optional. An optional list of one or more dates to exclude from the working calendar, such as state and federal holidays and floating holidays. The list can be either a range of values that contain the dates or an array constant of the serial numbers that represent the dates.
4327
4339
  * @returns
4328
4340
  */
4329
- export function WORKDAY(start_date: any, days: any, holidays: any): any;
4341
+ export function WORKDAY(start_date: any, days: any, holidays: any): string | Error;
4330
4342
  export namespace WORKDAY {
4331
4343
  /**
4332
4344
  * Returns the serial number of the date before or after a specified number of workdays using parameters to indicate which and how many days are weekend days.
@@ -4339,7 +4351,7 @@ export namespace WORKDAY {
4339
4351
  * @param {*} holidays Optional. An optional set of one or more dates that are to be excluded from the working day calendar. Holidays shall be a range of values that contain the dates, or an array constant of the serial values that represent those dates. The ordering of dates or serial values in holidays can be arbitrary.
4340
4352
  * @returns
4341
4353
  */
4342
- function INTL(start_date: any, days: any, weekend: any, holidays: any): any;
4354
+ function INTL(start_date: any, days: any, weekend: any, holidays: any): string | Error;
4343
4355
  }
4344
4356
  /**
4345
4357
  * Returns the serial number of the date before or after a specified number of workdays using parameters to indicate which and how many days are weekend days.
@@ -4352,7 +4364,19 @@ export namespace WORKDAY {
4352
4364
  * @param {*} holidays Optional. An optional set of one or more dates that are to be excluded from the working day calendar. Holidays shall be a range of values that contain the dates, or an array constant of the serial values that represent those dates. The ordering of dates or serial values in holidays can be arbitrary.
4353
4365
  * @returns
4354
4366
  */
4355
- export function WORKDAYINTL(start_date: any, days: any, weekend: any, holidays: any): any;
4367
+ export function WORKDAYINTL(start_date: any, days: any, weekend: any, holidays: any): string | Error;
4368
+ /**
4369
+ * Returns the serial number of the date before or after a specified number of workdays using parameters to indicate which and how many days are weekend days.
4370
+ *
4371
+ * Category: Date and time
4372
+ *
4373
+ * @param {*} start_date The start date, truncated to integer.
4374
+ * @param {*} days The number of workdays before or after the start_date. A positive value yields a future date; a negative value yields a past date; a zero value yields the start_date. Day-offset is truncated to an integer.
4375
+ * @param {*} weekend Optional. Indicates the days of the week that are weekend days and are not considered working days. Weekend is a weekend number or string that specifies when weekends occur. Weekend number values indicate the following weekend days:
4376
+ * @param {*} holidays Optional. An optional set of one or more dates that are to be excluded from the working day calendar. Holidays shall be a range of values that contain the dates, or an array constant of the serial values that represent those dates. The ordering of dates or serial values in holidays can be arbitrary.
4377
+ * @returns
4378
+ */
4379
+ export function WORKDAY_INTL(start_date: any, days: any, weekend: any, holidays: any): string | Error;
4356
4380
  /**
4357
4381
  * Returns the internal rate of return for a schedule of cash flows that is not necessarily periodic.
4358
4382
  *
@@ -4462,6 +4486,7 @@ declare var symbols: Readonly<{
4462
4486
  declare var date: Readonly<{
4463
4487
  __proto__: any;
4464
4488
  dateToSerial: typeof dateToSerial;
4489
+ formatDate: typeof formatDate;
4465
4490
  readonly returnSerial: boolean;
4466
4491
  serialToDate: typeof serialToDate;
4467
4492
  useDate: typeof useDate;
@@ -4560,6 +4585,7 @@ declare function NE(value1: any, value2: any, ...args: any[]): boolean | Error;
4560
4585
  */
4561
4586
  declare function POW(base: any, exponent: any, ...args: any[]): any;
4562
4587
  declare function dateToSerial(date: any): number;
4588
+ declare function formatDate(date: any): string;
4563
4589
  declare function serialToDate(serial: any): Date;
4564
4590
  declare function useDate(): void;
4565
4591
  declare function useSerial(): void;