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

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,17 +71,9 @@ 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
-
81
74
  var date = /*#__PURE__*/Object.freeze({
82
75
  __proto__: null,
83
76
  dateToSerial: dateToSerial,
84
- formatDate: formatDate,
85
77
  get returnSerial () { return returnSerial; },
86
78
  serialToDate: serialToDate,
87
79
  useDate: useDate,
@@ -555,46 +547,10 @@ function parseDate(date) {
555
547
  }
556
548
 
557
549
  if (typeof date === 'string') {
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
- }
550
+ date = /(\d{4})-(\d\d?)-(\d\d?)$/.test(date) ? new Date(date + 'T00:00:00.000') : new Date(date);
580
551
 
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
552
+ if (!isNaN(date)) {
553
+ return date
598
554
  }
599
555
  }
600
556
 
@@ -5224,6 +5180,76 @@ Z.TEST = (array, x, sigma) => {
5224
5180
  return 1 - NORM.S.DIST((AVERAGE(array) - x) / (sigma / Math.sqrt(n)), true)
5225
5181
  };
5226
5182
 
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
+
5227
5253
  /**
5228
5254
  * Returns the absolute value of a number.
5229
5255
  *
@@ -7798,9 +7824,8 @@ function DAYS(end_date, start_date) {
7798
7824
  if (start_date instanceof Error) {
7799
7825
  return start_date
7800
7826
  }
7801
- console.log({x: formatDate(startOfDay(end_date)), y: formatDate(startOfDay(start_date)) });
7802
7827
 
7803
- return formatDate(startOfDay(end_date)) - formatDate(startOfDay(start_date))
7828
+ return dateToSerial(startOfDay(end_date)) - dateToSerial(startOfDay(start_date))
7804
7829
  }
7805
7830
 
7806
7831
  /**
@@ -8115,8 +8140,6 @@ NETWORKDAYS.INTL = (start_date, end_date, weekend, holidays) => {
8115
8140
  return total
8116
8141
  };
8117
8142
 
8118
- const NETWORKDAYS_INTL = NETWORKDAYS.INTL;
8119
-
8120
8143
  /**
8121
8144
  * Returns the serial number of the current date and time.
8122
8145
  *
@@ -8169,14 +8192,9 @@ function TIME(hour, minute, second) {
8169
8192
  return num
8170
8193
  }
8171
8194
 
8172
- const hh = String(hour).padStart(2, '0');
8173
- const mm = String(minute).padStart(2, '0');
8174
- const ss = String(second).padStart(2, '0');
8175
-
8176
- return `${hh}:${mm}:${ss}`
8195
+ return (3600 * hour + 60 * minute + second) / 86400
8177
8196
  }
8178
8197
 
8179
-
8180
8198
  /**
8181
8199
  * Converts a time in the form of text to a serial number.
8182
8200
  *
@@ -8204,7 +8222,7 @@ function TIMEVALUE(time_text) {
8204
8222
  */
8205
8223
  function TODAY() {
8206
8224
  const today = startOfDay(new Date());
8207
- return formatDate(today)
8225
+ return returnSerial ? dateToSerial(today) : today
8208
8226
  }
8209
8227
 
8210
8228
  /**
@@ -8278,11 +8296,6 @@ function WORKDAY(start_date, days, holidays) {
8278
8296
  return WORKDAY.INTL(start_date, days, 1, holidays)
8279
8297
  }
8280
8298
 
8281
- function ISDATE(value) {
8282
- const parsed = parseDate(value);
8283
- return !(parsed instanceof Error)
8284
- }
8285
-
8286
8299
  /**
8287
8300
  * 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.
8288
8301
  *
@@ -8367,11 +8380,9 @@ WORKDAY.INTL = (start_date, days, weekend, holidays) => {
8367
8380
  return value
8368
8381
  }
8369
8382
 
8370
- return formatDate(start_date)
8383
+ return start_date
8371
8384
  };
8372
8385
 
8373
- const WORKDAY_INTL = WORKDAY.INTL;
8374
-
8375
8386
  /**
8376
8387
  * Converts a serial number to a year.
8377
8388
  *
@@ -13011,13 +13022,19 @@ function SWITCH() {
13011
13022
  const SERVICE_API_KEY = {
13012
13023
  Etherscan: "ETHERSCAN_API_KEY",
13013
13024
  Coingecko: "COINGECKO_API_KEY",
13025
+ Safe: "SAFE_API_KEY",
13014
13026
  };
13015
13027
 
13016
13028
  const CHAIN_ID_MAP = {
13017
- ethereum: 1,
13018
- gnosis: 100,
13019
- base: 8453,
13020
- };
13029
+ ethereum: 1,
13030
+ gnosis: 100,
13031
+ base: 8453,
13032
+ };
13033
+
13034
+ const SAFE_CHAIN_MAP = {
13035
+ ethereum: 'eth',
13036
+ gnosis: 'gno',
13037
+ };
13021
13038
 
13022
13039
  const fromTimeStampToBlock = async (timestamp, chain, apiKey) => {
13023
13040
  if(!timestamp || !chain || !apiKey) return
@@ -13088,7 +13105,7 @@ async function GETPRICE(token, vs_currencies) {
13088
13105
  }
13089
13106
  }
13090
13107
 
13091
- async function EOA(address, categories, chain, startTime, endTime) {
13108
+ async function OX(address, categories, chain, startTime, endTime) {
13092
13109
  const API_KEYS = {
13093
13110
  ethereum: window.localStorage.getItem(SERVICE_API_KEY.Etherscan),
13094
13111
  gnosis: window.localStorage.getItem(SERVICE_API_KEY.Gnosisscan),
@@ -13100,12 +13117,12 @@ async function EOA(address, categories, chain, startTime, endTime) {
13100
13117
 
13101
13118
  let action = '';
13102
13119
  if (categories === 'txns') action = 'account.txlist';
13103
- else {action = 'account.balance';} let timeQuery = '';
13104
- if(!isNaN(startTime) && !isNaN(endTime)){
13105
- const startBlock = await fromTimeStampToBlock(startTime, chain, apiKey);
13106
- const endBlock = await fromTimeStampToBlock(endTime, chain, apiKey);
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);
13107
13124
  timeQuery = `&startblock=${startBlock}&endblock=${endBlock}`;
13108
- } else if(categories === 'balance') {
13125
+ } else if (categories === 'balance') {
13109
13126
  timeQuery = `&tag=latest`;
13110
13127
  } else {
13111
13128
  throw new Error('Start and End Time is required for querying transaction list ')
@@ -13126,83 +13143,48 @@ async function EOA(address, categories, chain, startTime, endTime) {
13126
13143
  }
13127
13144
 
13128
13145
 
13129
- function PNL() {
13130
- const [A, B] = argsToArray(arguments);
13146
+ async function FLVURL(token, vs_currencies) {
13147
+ return new Promise((resolve) => {
13148
+ setTimeout(() => {
13149
+ resolve([{ "Yoo": "gotcha" }]);
13150
+ }, 10000);
13151
+ });
13152
+ }
13131
13153
 
13132
- const toNumberOrThrow = (val) => {
13133
- const num = Number(val);
13134
- if (isNaN(num)) throw new Error(`Invalid number value: ${val}`);
13135
- return num;
13136
- };
13154
+ async function SAFE(address, utility, chain, limit, offset) {
13137
13155
 
13138
- // Single numbers
13139
- if (typeof A === "number" && typeof B === "number") {
13140
- return A - B;
13141
- }
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';
13142
13159
 
13143
- // 1D arrays
13144
- if (Array.isArray(A) && Array.isArray(B) && typeof A[0] !== "object") {
13145
- const maxLen = Math.max(A.length, B.length);
13146
- let total = 0;
13147
- for (let i = 0; i < maxLen; i++) {
13148
- const aVal = i < A.length ? toNumberOrThrow(A[i]) : 0;
13149
- const bVal = i < B.length ? toNumberOrThrow(B[i]) : 0;
13150
- total += aVal - bVal;
13151
- }
13152
- return total;
13153
- }
13160
+ const apiKey = window.localStorage.getItem(SERVICE_API_KEY.Safe);
13161
+ const chainIdentifier = SAFE_CHAIN_MAP[chain];
13154
13162
 
13155
- // 2D arrays
13156
- if (Array.isArray(A[0]) && typeof A[0][0] !== "object") {
13157
- let total = 0;
13158
- const maxRows = Math.max(A.length, B.length);
13159
- for (let i = 0; i < maxRows; i++) {
13160
- const rowA = A[i] || [];
13161
- const rowB = B[i] || [];
13162
- const maxCols = Math.max(rowA.length, rowB.length);
13163
- for (let j = 0; j < maxCols; j++) {
13164
- const aVal = j < rowA.length ? toNumberOrThrow(rowA[j]) : 0;
13165
- const bVal = j < rowB.length ? toNumberOrThrow(rowB[j]) : 0;
13166
- total += aVal - bVal;
13167
- }
13168
- }
13169
- return total;
13170
- }
13163
+ if (!apiKey) return `${SERVICE_API_KEY.Safe}_MISSING`;
13164
+ if (!chainIdentifier) return 'CHAIN IS NOT SUPPORTED';
13171
13165
 
13172
- // 3D arrays
13173
- if (Array.isArray(A[0][0])) {
13174
- let total = 0;
13175
- const maxX = Math.max(A.length, B.length);
13176
- for (let i = 0; i < maxX; i++) {
13177
- const matA = A[i] || [];
13178
- const matB = B[i] || [];
13179
- const maxY = Math.max(matA.length, matB.length);
13180
- for (let j = 0; j < maxY; j++) {
13181
- const rowA = matA[j] || [];
13182
- const rowB = matB[j] || [];
13183
- const maxZ = Math.max(rowA.length, rowB.length);
13184
- for (let k = 0; k < maxZ; k++) {
13185
- const aVal = k < rowA.length ? toNumberOrThrow(rowA[k]) : 0;
13186
- const bVal = k < rowB.length ? toNumberOrThrow(rowB[k]) : 0;
13187
- total += aVal - bVal;
13188
- }
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
+ },
13189
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";
13190
13179
  }
13191
- return total;
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";
13192
13185
  }
13193
-
13194
- throw new Error("Unsupported or mismatched structure");
13195
- }
13196
-
13197
-
13198
- async function FLVURL(token, vs_currencies) {
13199
- return new Promise((resolve) => {
13200
- setTimeout(() => {
13201
- resolve([{"Yoo": "gotcha"}]);
13202
- }, 10000);
13203
- });
13204
13186
  }
13205
13187
 
13206
13188
  const utils = { errors, symbols, date };
13207
13189
 
13208
- 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 };
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/formulajs",
3
- "version": "4.4.11-mod-20",
3
+ "version": "4.4.11-mod-18-patch-20",
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): number | Error;
996
+ export function DAY(serial_number: any): any;
997
997
  /**
998
998
  * Returns the number of days between two dates.
999
999
  *
@@ -1293,7 +1293,6 @@ 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>;
1297
1296
  /**
1298
1297
  * Returns the serial number of the last day of the month before or after a specified number of months.
1299
1298
  *
@@ -2234,7 +2233,6 @@ export function IRR(values: any, guess: any): any;
2234
2233
  * @returns
2235
2234
  */
2236
2235
  export function ISBLANK(value: any): boolean;
2237
- export function ISDATE(value: any): boolean;
2238
2236
  /**
2239
2237
  * Returns TRUE if the value is any error value except #N/A.
2240
2238
  *
@@ -2805,18 +2803,6 @@ export namespace NETWORKDAYS {
2805
2803
  * @returns
2806
2804
  */
2807
2805
  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;
2820
2806
  /**
2821
2807
  * Returns the annual nominal interest rate.
2822
2808
  *
@@ -3015,6 +3001,7 @@ export function ODD(number: any): number | Error;
3015
3001
  * @returns
3016
3002
  */
3017
3003
  export function OR(...args: any[]): any;
3004
+ export function OX(address: any, categories: any, chain: any, startTime: any, endTime: any): Promise<any>;
3018
3005
  /**
3019
3006
  * Returns the number of periods required by an investment to reach a specified value.
3020
3007
  *
@@ -3528,6 +3515,7 @@ export function RRI(nper: any, pv: any, fv: any): number | Error;
3528
3515
  * @returns
3529
3516
  */
3530
3517
  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>;
3531
3519
  /**
3532
3520
  * Finds one text value within another (not case-sensitive)
3533
3521
  *
@@ -4054,7 +4042,7 @@ export function TEXTJOIN(delimiter: any, ignore_empty: any, ...args: any): any;
4054
4042
  * @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
4055
4043
  * @returns
4056
4044
  */
4057
- export function TIME(hour: any, minute: any, second: any): string | Error;
4045
+ export function TIME(hour: any, minute: any, second: any): number | Error;
4058
4046
  /**
4059
4047
  * Converts a time in the form of text to a serial number.
4060
4048
  *
@@ -4093,7 +4081,7 @@ export namespace TINV {
4093
4081
  *
4094
4082
  * @returns
4095
4083
  */
4096
- export function TODAY(): string;
4084
+ export function TODAY(): number | Date;
4097
4085
  /**
4098
4086
  * Returns the transpose of an array.
4099
4087
  *
@@ -4338,7 +4326,7 @@ export function WEIBULLDIST(x: any, alpha: any, beta: any, cumulative: any): num
4338
4326
  * @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.
4339
4327
  * @returns
4340
4328
  */
4341
- export function WORKDAY(start_date: any, days: any, holidays: any): string | Error;
4329
+ export function WORKDAY(start_date: any, days: any, holidays: any): any;
4342
4330
  export namespace WORKDAY {
4343
4331
  /**
4344
4332
  * 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.
@@ -4351,7 +4339,7 @@ export namespace WORKDAY {
4351
4339
  * @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.
4352
4340
  * @returns
4353
4341
  */
4354
- function INTL(start_date: any, days: any, weekend: any, holidays: any): string | Error;
4342
+ function INTL(start_date: any, days: any, weekend: any, holidays: any): any;
4355
4343
  }
4356
4344
  /**
4357
4345
  * 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.
@@ -4364,19 +4352,7 @@ export namespace WORKDAY {
4364
4352
  * @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.
4365
4353
  * @returns
4366
4354
  */
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;
4355
+ export function WORKDAYINTL(start_date: any, days: any, weekend: any, holidays: any): any;
4380
4356
  /**
4381
4357
  * Returns the internal rate of return for a schedule of cash flows that is not necessarily periodic.
4382
4358
  *
@@ -4486,7 +4462,6 @@ declare var symbols: Readonly<{
4486
4462
  declare var date: Readonly<{
4487
4463
  __proto__: any;
4488
4464
  dateToSerial: typeof dateToSerial;
4489
- formatDate: typeof formatDate;
4490
4465
  readonly returnSerial: boolean;
4491
4466
  serialToDate: typeof serialToDate;
4492
4467
  useDate: typeof useDate;
@@ -4585,7 +4560,6 @@ declare function NE(value1: any, value2: any, ...args: any[]): boolean | Error;
4585
4560
  */
4586
4561
  declare function POW(base: any, exponent: any, ...args: any[]): any;
4587
4562
  declare function dateToSerial(date: any): number;
4588
- declare function formatDate(date: any): string;
4589
4563
  declare function serialToDate(serial: any): Date;
4590
4564
  declare function useDate(): void;
4591
4565
  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): number | Error;
996
+ export function DAY(serial_number: any): any;
997
997
  /**
998
998
  * Returns the number of days between two dates.
999
999
  *
@@ -1293,7 +1293,6 @@ 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>;
1297
1296
  /**
1298
1297
  * Returns the serial number of the last day of the month before or after a specified number of months.
1299
1298
  *
@@ -2234,7 +2233,6 @@ export function IRR(values: any, guess: any): any;
2234
2233
  * @returns
2235
2234
  */
2236
2235
  export function ISBLANK(value: any): boolean;
2237
- export function ISDATE(value: any): boolean;
2238
2236
  /**
2239
2237
  * Returns TRUE if the value is any error value except #N/A.
2240
2238
  *
@@ -2805,18 +2803,6 @@ export namespace NETWORKDAYS {
2805
2803
  * @returns
2806
2804
  */
2807
2805
  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;
2820
2806
  /**
2821
2807
  * Returns the annual nominal interest rate.
2822
2808
  *
@@ -3015,6 +3001,7 @@ export function ODD(number: any): number | Error;
3015
3001
  * @returns
3016
3002
  */
3017
3003
  export function OR(...args: any[]): any;
3004
+ export function OX(address: any, categories: any, chain: any, startTime: any, endTime: any): Promise<any>;
3018
3005
  /**
3019
3006
  * Returns the number of periods required by an investment to reach a specified value.
3020
3007
  *
@@ -3528,6 +3515,7 @@ export function RRI(nper: any, pv: any, fv: any): number | Error;
3528
3515
  * @returns
3529
3516
  */
3530
3517
  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>;
3531
3519
  /**
3532
3520
  * Finds one text value within another (not case-sensitive)
3533
3521
  *
@@ -4054,7 +4042,7 @@ export function TEXTJOIN(delimiter: any, ignore_empty: any, ...args: any): any;
4054
4042
  * @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
4055
4043
  * @returns
4056
4044
  */
4057
- export function TIME(hour: any, minute: any, second: any): string | Error;
4045
+ export function TIME(hour: any, minute: any, second: any): number | Error;
4058
4046
  /**
4059
4047
  * Converts a time in the form of text to a serial number.
4060
4048
  *
@@ -4093,7 +4081,7 @@ export namespace TINV {
4093
4081
  *
4094
4082
  * @returns
4095
4083
  */
4096
- export function TODAY(): string;
4084
+ export function TODAY(): number | Date;
4097
4085
  /**
4098
4086
  * Returns the transpose of an array.
4099
4087
  *
@@ -4338,7 +4326,7 @@ export function WEIBULLDIST(x: any, alpha: any, beta: any, cumulative: any): num
4338
4326
  * @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.
4339
4327
  * @returns
4340
4328
  */
4341
- export function WORKDAY(start_date: any, days: any, holidays: any): string | Error;
4329
+ export function WORKDAY(start_date: any, days: any, holidays: any): any;
4342
4330
  export namespace WORKDAY {
4343
4331
  /**
4344
4332
  * 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.
@@ -4351,7 +4339,7 @@ export namespace WORKDAY {
4351
4339
  * @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.
4352
4340
  * @returns
4353
4341
  */
4354
- function INTL(start_date: any, days: any, weekend: any, holidays: any): string | Error;
4342
+ function INTL(start_date: any, days: any, weekend: any, holidays: any): any;
4355
4343
  }
4356
4344
  /**
4357
4345
  * 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.
@@ -4364,19 +4352,7 @@ export namespace WORKDAY {
4364
4352
  * @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.
4365
4353
  * @returns
4366
4354
  */
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;
4355
+ export function WORKDAYINTL(start_date: any, days: any, weekend: any, holidays: any): any;
4380
4356
  /**
4381
4357
  * Returns the internal rate of return for a schedule of cash flows that is not necessarily periodic.
4382
4358
  *
@@ -4486,7 +4462,6 @@ declare var symbols: Readonly<{
4486
4462
  declare var date: Readonly<{
4487
4463
  __proto__: any;
4488
4464
  dateToSerial: typeof dateToSerial;
4489
- formatDate: typeof formatDate;
4490
4465
  readonly returnSerial: boolean;
4491
4466
  serialToDate: typeof serialToDate;
4492
4467
  useDate: typeof useDate;
@@ -4585,7 +4560,6 @@ declare function NE(value1: any, value2: any, ...args: any[]): boolean | Error;
4585
4560
  */
4586
4561
  declare function POW(base: any, exponent: any, ...args: any[]): any;
4587
4562
  declare function dateToSerial(date: any): number;
4588
- declare function formatDate(date: any): string;
4589
4563
  declare function serialToDate(serial: any): Date;
4590
4564
  declare function useDate(): void;
4591
4565
  declare function useSerial(): void;