@fileverse-dev/formulajs 4.4.11-mod-18-patch-20 → 4.4.11-mod-21

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
+ }
572
+
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
+ }
551
580
 
552
- if (!isNaN(date)) {
553
- return date
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
 
@@ -5180,76 +5224,6 @@ Z.TEST = (array, x, sigma) => {
5180
5224
  return 1 - NORM.S.DIST((AVERAGE(array) - x) / (sigma / Math.sqrt(n)), true)
5181
5225
  };
5182
5226
 
5183
- function PNL() {
5184
- const [A, B] = argsToArray(arguments);
5185
-
5186
- const toNumberOrThrow = (val) => {
5187
- const num = Number(val);
5188
- if (isNaN(num)) throw new Error(`Invalid number value: ${val}`);
5189
- return num;
5190
- };
5191
-
5192
- // Single numbers
5193
- if (typeof A === "number" && typeof B === "number") {
5194
- return A - B;
5195
- }
5196
-
5197
- // 1D arrays
5198
- if (Array.isArray(A) && Array.isArray(B) && typeof A[0] !== "object") {
5199
- const maxLen = Math.max(A.length, B.length);
5200
- let total = 0;
5201
- for (let i = 0; i < maxLen; i++) {
5202
- const aVal = i < A.length ? toNumberOrThrow(A[i]) : 0;
5203
- const bVal = i < B.length ? toNumberOrThrow(B[i]) : 0;
5204
- total += aVal - bVal;
5205
- }
5206
- return total;
5207
- }
5208
-
5209
- // 2D arrays
5210
- if (Array.isArray(A[0]) && typeof A[0][0] !== "object") {
5211
- let total = 0;
5212
- const maxRows = Math.max(A.length, B.length);
5213
- for (let i = 0; i < maxRows; i++) {
5214
- const rowA = A[i] || [];
5215
- const rowB = B[i] || [];
5216
- const maxCols = Math.max(rowA.length, rowB.length);
5217
- for (let j = 0; j < maxCols; j++) {
5218
- const aVal = j < rowA.length ? toNumberOrThrow(rowA[j]) : 0;
5219
- const bVal = j < rowB.length ? toNumberOrThrow(rowB[j]) : 0;
5220
- total += aVal - bVal;
5221
- }
5222
- }
5223
- return total;
5224
- }
5225
-
5226
- // 3D arrays
5227
- if (Array.isArray(A[0][0])) {
5228
- let total = 0;
5229
- const maxX = Math.max(A.length, B.length);
5230
- for (let i = 0; i < maxX; i++) {
5231
- const matA = A[i] || [];
5232
- const matB = B[i] || [];
5233
- const maxY = Math.max(matA.length, matB.length);
5234
- for (let j = 0; j < maxY; j++) {
5235
- const rowA = matA[j] || [];
5236
- const rowB = matB[j] || [];
5237
- const maxZ = Math.max(rowA.length, rowB.length);
5238
- for (let k = 0; k < maxZ; k++) {
5239
- const aVal = k < rowA.length ? toNumberOrThrow(rowA[k]) : 0;
5240
- const bVal = k < rowB.length ? toNumberOrThrow(rowB[k]) : 0;
5241
- total += aVal - bVal;
5242
- }
5243
- }
5244
- }
5245
- return total;
5246
- }
5247
-
5248
- throw new Error("Unsupported or mismatched structure");
5249
- }
5250
-
5251
-
5252
-
5253
5227
  /**
5254
5228
  * Returns the absolute value of a number.
5255
5229
  *
@@ -6944,8 +6918,6 @@ function SUBTOTAL(function_num, ref1) {
6944
6918
  function SUM() {
6945
6919
  let result = 0;
6946
6920
 
6947
- console.log("LLLLO", argsToArray(arguments), {arguments});
6948
-
6949
6921
  arrayEach(argsToArray(arguments), (value) => {
6950
6922
  if (result instanceof Error) {
6951
6923
  return false
@@ -7825,7 +7797,8 @@ function DAYS(end_date, start_date) {
7825
7797
  return start_date
7826
7798
  }
7827
7799
 
7828
- return dateToSerial(startOfDay(end_date)) - dateToSerial(startOfDay(start_date))
7800
+ const diffMs = startOfDay(end_date).getTime() - startOfDay(start_date).getTime();
7801
+ return diffMs / (1000 * 60 * 60 * 24);
7829
7802
  }
7830
7803
 
7831
7804
  /**
@@ -8140,6 +8113,8 @@ NETWORKDAYS.INTL = (start_date, end_date, weekend, holidays) => {
8140
8113
  return total
8141
8114
  };
8142
8115
 
8116
+ const NETWORKDAYS_INTL = NETWORKDAYS.INTL;
8117
+
8143
8118
  /**
8144
8119
  * Returns the serial number of the current date and time.
8145
8120
  *
@@ -8192,9 +8167,14 @@ function TIME(hour, minute, second) {
8192
8167
  return num
8193
8168
  }
8194
8169
 
8195
- return (3600 * hour + 60 * minute + second) / 86400
8170
+ const hh = String(hour).padStart(2, '0');
8171
+ const mm = String(minute).padStart(2, '0');
8172
+ const ss = String(second).padStart(2, '0');
8173
+
8174
+ return `${hh}:${mm}:${ss}`
8196
8175
  }
8197
8176
 
8177
+
8198
8178
  /**
8199
8179
  * Converts a time in the form of text to a serial number.
8200
8180
  *
@@ -8222,7 +8202,7 @@ function TIMEVALUE(time_text) {
8222
8202
  */
8223
8203
  function TODAY() {
8224
8204
  const today = startOfDay(new Date());
8225
- return returnSerial ? dateToSerial(today) : today
8205
+ return formatDate(today)
8226
8206
  }
8227
8207
 
8228
8208
  /**
@@ -8296,6 +8276,11 @@ function WORKDAY(start_date, days, holidays) {
8296
8276
  return WORKDAY.INTL(start_date, days, 1, holidays)
8297
8277
  }
8298
8278
 
8279
+ function ISDATE(value) {
8280
+ const parsed = parseDate(value);
8281
+ return !(parsed instanceof Error)
8282
+ }
8283
+
8299
8284
  /**
8300
8285
  * 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
8286
  *
@@ -8380,9 +8365,11 @@ WORKDAY.INTL = (start_date, days, weekend, holidays) => {
8380
8365
  return value
8381
8366
  }
8382
8367
 
8383
- return start_date
8368
+ return formatDate(start_date)
8384
8369
  };
8385
8370
 
8371
+ const WORKDAY_INTL = WORKDAY.INTL;
8372
+
8386
8373
  /**
8387
8374
  * Converts a serial number to a year.
8388
8375
  *
@@ -13022,19 +13009,13 @@ function SWITCH() {
13022
13009
  const SERVICE_API_KEY = {
13023
13010
  Etherscan: "ETHERSCAN_API_KEY",
13024
13011
  Coingecko: "COINGECKO_API_KEY",
13025
- Safe: "SAFE_API_KEY",
13026
13012
  };
13027
13013
 
13028
13014
  const CHAIN_ID_MAP = {
13029
- ethereum: 1,
13030
- gnosis: 100,
13031
- base: 8453,
13032
- };
13033
-
13034
- const SAFE_CHAIN_MAP = {
13035
- ethereum: 'eth',
13036
- gnosis: 'gno',
13037
- };
13015
+ ethereum: 1,
13016
+ gnosis: 100,
13017
+ base: 8453,
13018
+ };
13038
13019
 
13039
13020
  const fromTimeStampToBlock = async (timestamp, chain, apiKey) => {
13040
13021
  if(!timestamp || !chain || !apiKey) return
@@ -13048,7 +13029,7 @@ if(!timestamp || !chain || !apiKey) return
13048
13029
 
13049
13030
  async function ETHERSCAN(address, page, offset) {
13050
13031
  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}`;
13032
+ 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}`;
13052
13033
 
13053
13034
  try {
13054
13035
  const response = await fetch(url);
@@ -13105,7 +13086,7 @@ async function GETPRICE(token, vs_currencies) {
13105
13086
  }
13106
13087
  }
13107
13088
 
13108
- async function OX(address, categories, chain, startTime, endTime) {
13089
+ async function EOA(address, categories, chain, startTime, endTime) {
13109
13090
  const API_KEYS = {
13110
13091
  ethereum: window.localStorage.getItem(SERVICE_API_KEY.Etherscan),
13111
13092
  gnosis: window.localStorage.getItem(SERVICE_API_KEY.Gnosisscan),
@@ -13117,12 +13098,12 @@ async function OX(address, categories, chain, startTime, endTime) {
13117
13098
 
13118
13099
  let action = '';
13119
13100
  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);
13101
+ else {action = 'account.balance';} let timeQuery = '';
13102
+ if(!isNaN(startTime) && !isNaN(endTime)){
13103
+ const startBlock = await fromTimeStampToBlock(startTime, chain, apiKey);
13104
+ const endBlock = await fromTimeStampToBlock(endTime, chain, apiKey);
13124
13105
  timeQuery = `&startblock=${startBlock}&endblock=${endBlock}`;
13125
- } else if (categories === 'balance') {
13106
+ } else if(categories === 'balance') {
13126
13107
  timeQuery = `&tag=latest`;
13127
13108
  } else {
13128
13109
  throw new Error('Start and End Time is required for querying transaction list ')
@@ -13143,48 +13124,83 @@ async function OX(address, categories, chain, startTime, endTime) {
13143
13124
  }
13144
13125
 
13145
13126
 
13146
- async function FLVURL(token, vs_currencies) {
13147
- return new Promise((resolve) => {
13148
- setTimeout(() => {
13149
- resolve([{ "Yoo": "gotcha" }]);
13150
- }, 10000);
13151
- });
13152
- }
13127
+ function PNL() {
13128
+ const [A, B] = argsToArray(arguments);
13153
13129
 
13154
- async function SAFE(address, utility, chain, limit, offset) {
13130
+ const toNumberOrThrow = (val) => {
13131
+ const num = Number(val);
13132
+ if (isNaN(num)) throw new Error(`Invalid number value: ${val}`);
13133
+ return num;
13134
+ };
13155
13135
 
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';
13136
+ // Single numbers
13137
+ if (typeof A === "number" && typeof B === "number") {
13138
+ return A - B;
13139
+ }
13159
13140
 
13160
- const apiKey = window.localStorage.getItem(SERVICE_API_KEY.Safe);
13161
- const chainIdentifier = SAFE_CHAIN_MAP[chain];
13141
+ // 1D arrays
13142
+ if (Array.isArray(A) && Array.isArray(B) && typeof A[0] !== "object") {
13143
+ const maxLen = Math.max(A.length, B.length);
13144
+ let total = 0;
13145
+ for (let i = 0; i < maxLen; i++) {
13146
+ const aVal = i < A.length ? toNumberOrThrow(A[i]) : 0;
13147
+ const bVal = i < B.length ? toNumberOrThrow(B[i]) : 0;
13148
+ total += aVal - bVal;
13149
+ }
13150
+ return total;
13151
+ }
13162
13152
 
13163
- if (!apiKey) return `${SERVICE_API_KEY.Safe}_MISSING`;
13164
- if (!chainIdentifier) return 'CHAIN IS NOT SUPPORTED';
13153
+ // 2D arrays
13154
+ if (Array.isArray(A[0]) && typeof A[0][0] !== "object") {
13155
+ let total = 0;
13156
+ const maxRows = Math.max(A.length, B.length);
13157
+ for (let i = 0; i < maxRows; i++) {
13158
+ const rowA = A[i] || [];
13159
+ const rowB = B[i] || [];
13160
+ const maxCols = Math.max(rowA.length, rowB.length);
13161
+ for (let j = 0; j < maxCols; j++) {
13162
+ const aVal = j < rowA.length ? toNumberOrThrow(rowA[j]) : 0;
13163
+ const bVal = j < rowB.length ? toNumberOrThrow(rowB[j]) : 0;
13164
+ total += aVal - bVal;
13165
+ }
13166
+ }
13167
+ return total;
13168
+ }
13165
13169
 
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
- },
13170
+ // 3D arrays
13171
+ if (Array.isArray(A[0][0])) {
13172
+ let total = 0;
13173
+ const maxX = Math.max(A.length, B.length);
13174
+ for (let i = 0; i < maxX; i++) {
13175
+ const matA = A[i] || [];
13176
+ const matB = B[i] || [];
13177
+ const maxY = Math.max(matA.length, matB.length);
13178
+ for (let j = 0; j < maxY; j++) {
13179
+ const rowA = matA[j] || [];
13180
+ const rowB = matB[j] || [];
13181
+ const maxZ = Math.max(rowA.length, rowB.length);
13182
+ for (let k = 0; k < maxZ; k++) {
13183
+ const aVal = k < rowA.length ? toNumberOrThrow(rowA[k]) : 0;
13184
+ const bVal = k < rowB.length ? toNumberOrThrow(rowB[k]) : 0;
13185
+ total += aVal - bVal;
13186
+ }
13173
13187
  }
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
13188
  }
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";
13189
+ return total;
13185
13190
  }
13191
+
13192
+ throw new Error("Unsupported or mismatched structure");
13193
+ }
13194
+
13195
+
13196
+ async function FLVURL(token, vs_currencies) {
13197
+ return new Promise((resolve) => {
13198
+ setTimeout(() => {
13199
+ resolve([{"Yoo": "gotcha"}]);
13200
+ }, 10000);
13201
+ });
13186
13202
  }
13187
13203
 
13188
13204
  const utils = { errors, symbols, date };
13189
13205
 
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 };
13206
+ 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, 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, 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, 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",
4
4
  "description": "JavaScript implementation of most Microsoft Excel formula functions",
5
5
  "author": "Formulajs",
6
6
  "publishConfig": {
@@ -993,7 +993,7 @@ export function DAVERAGE(database: any, field: any, criteria: any): number | Err
993
993
  * @param {*} serial_number The date of the day you are trying to find.
994
994
  * @returns
995
995
  */
996
- export function DAY(serial_number: any): any;
996
+ export function DAY(serial_number: any): number | Error;
997
997
  /**
998
998
  * Returns the number of days between two dates.
999
999
  *
@@ -1293,6 +1293,7 @@ export function EDATE(start_date: any, months: any): any;
1293
1293
  * @returns
1294
1294
  */
1295
1295
  export function EFFECT(nominal_rate: any, npery: any): number | Error;
1296
+ export function EOA(address: any, categories: any, chain: any, startTime: any, endTime: any): Promise<any>;
1296
1297
  /**
1297
1298
  * Returns the serial number of the last day of the month before or after a specified number of months.
1298
1299
  *
@@ -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;
@@ -993,7 +993,7 @@ export function DAVERAGE(database: any, field: any, criteria: any): number | Err
993
993
  * @param {*} serial_number The date of the day you are trying to find.
994
994
  * @returns
995
995
  */
996
- export function DAY(serial_number: any): any;
996
+ export function DAY(serial_number: any): number | Error;
997
997
  /**
998
998
  * Returns the number of days between two dates.
999
999
  *
@@ -1293,6 +1293,7 @@ export function EDATE(start_date: any, months: any): any;
1293
1293
  * @returns
1294
1294
  */
1295
1295
  export function EFFECT(nominal_rate: any, npery: any): number | Error;
1296
+ export function EOA(address: any, categories: any, chain: any, startTime: any, endTime: any): Promise<any>;
1296
1297
  /**
1297
1298
  * Returns the serial number of the last day of the month before or after a specified number of months.
1298
1299
  *
@@ -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;