spreadsheet
typeScript/javascript spreadsheet parser, with formulas.
git clone https://git.vogt.world/spreadsheet.git
Log | Files | README.md
← Commit log
commit
message
[DOCS] fixing regular expression for generating DOCS.md
author
Ben Vogt <[email protected]>
date
2017-09-09 16:28:16
stats
3 file(s) changed, 29 insertions(+), 35 deletions(-)
files
DOCS.md
TODO.md
docs.sh
  1diff --git a/DOCS.md b/DOCS.md
  2index ffb14e2..e8ff30e 100644
  3--- a/DOCS.md
  4+++ b/DOCS.md
  5@@ -57,7 +57,7 @@
  6 ```
  7   Converts a provided date string in a known format to a date value. 
  8 @param dateString - The string representing the date. Understood formats include any date format which is normally auto-converted when entered, without quotation marks, directly into a cell. Understood formats may depend on region and language settings. 
  9-@returns {number} of days since 190011, inclusively. 
 10+@returns {number} of days since 1900/1/1, inclusively. 
 11 @constructor
 12 ```
 13 
 14@@ -163,7 +163,7 @@
 15 ### YEARFRAC 
 16 
 17 ```
 18-  Returns the number of years, including fractional years, between two dates using a specified day count convention.  Further reading:  http:christian-fries.deblogfile2013-yearfrac.html  http:finmath.netfinmath-lib  
 19+  Returns the number of years, including fractional years, between two dates using a specified day count convention.  Further reading:  http://christian-fries.de/blog/files/2013-yearfrac.html  http://finmath.net/finmath-lib  
 20 @param startDate - The start date to consider in the calculation. Must be a reference to a cell containing a date, a function returning a date type, or a number. 
 21 @param endDate - The end date to consider in the calculation. Must be a reference to a cell containing a date, a function returning a date type, or a number. 
 22 @param dayCountConvention - [ OPTIONAL - 0 by default ] - An indicator of what day count method to use. 
 23@@ -184,7 +184,7 @@
 24 
 25 ```
 26   Returns the hour component of a specific time, in numeric format. 
 27-@param time - The time from which to calculate the hour component. Must be a reference to a cell containing a datetime, a function returning a datetime type, or a number. 
 28+@param time - The time from which to calculate the hour component. Must be a reference to a cell containing a date/time, a function returning a date/time type, or a number. 
 29 @returns {number} 
 30 @constructor
 31 ```
 32@@ -193,7 +193,7 @@
 33 
 34 ```
 35   Returns the minute component of a specific time, in numeric format. 
 36-@param time - The time from which to calculate the minute component. Must be a reference to a cell containing a datetime, a function returning a datetime type, or a number. 
 37+@param time - The time from which to calculate the minute component. Must be a reference to a cell containing a date/time, a function returning a date/time type, or a number. 
 38 @returns {number} minute of the time passed in. 
 39 @constructor
 40 ```
 41@@ -202,7 +202,7 @@
 42 
 43 ```
 44   Returns the second component of a specific time, in numeric format. 
 45-@param time - The time from which to calculate the second component. Must be a reference to a cell containing a datetime, a function returning a datetime type, or a number. 
 46+@param time - The time from which to calculate the second component. Must be a reference to a cell containing a date/time, a function returning a date/time type, or a number. 
 47 @returns {number} second component of a specific time. 
 48 @constructor
 49 ```
 50@@ -224,7 +224,7 @@
 51   Returns the number of networking days between two provided days excluding specified weekend days and holidays. 
 52 @param startDate - The start date of the period from which to calculate the number of net working days. 
 53 @param endDate - The end date of the period from which to calculate the number of net working days. 
 54-@param weekend - [ OPTIONAL - 1 by default ] - A number or string representing which days of the week are considered weekends. String method: weekends can be specified using seven 0’s and 1’s, where the first number in the et represents Monday and the last number is for Sunday. A zero means that the day is a work day, a 1 means that the day is a weekend. For example, “0000011” would mean Saturday and Sunday are weekends. Number method: instead of using the string method above, a single number can be used. 1 = SaturdaySunday are weekends, 2 = SundayMonday, and this pattern repeats until 7 = FridaySaturday. 11 = Sunday is the only weekend, 12 = Monday is the only weekend, and this pattern repeats until 17 = Saturday is the only weekend. 
 55+@param weekend - [ OPTIONAL - 1 by default ] - A number or string representing which days of the week are considered weekends. String method: weekends can be specified using seven 0’s and 1’s, where the first number in the et represents Monday and the last number is for Sunday. A zero means that the day is a work day, a 1 means that the day is a weekend. For example, “0000011” would mean Saturday and Sunday are weekends. Number method: instead of using the string method above, a single number can be used. 1 = Saturday/Sunday are weekends, 2 = Sunday/Monday, and this pattern repeats until 7 = Friday/Saturday. 11 = Sunday is the only weekend, 12 = Monday is the only weekend, and this pattern repeats until 17 = Saturday is the only weekend. 
 56 @param holidays - [ OPTIONAL ] - A range or array constant containing the dates to consider as holidays. The values provided within an array for holidays must be date serial number values, as returned by N or date values, as returned by DATE, DATEVALUE or TO_DATE. Values specified by a range should be standard date values or date serial numbers. 
 57 @returns {number} of networking days between two provided days 
 58 @constructor
 59@@ -274,7 +274,7 @@
 60   Calculates the date after a specified number of workdays excluding specified weekend days and holidays. 
 61 @param startDate - The date from which to begin counting. 
 62 @param numberOfDays - The number of working days to advance from start_date. If negative, counts backwards. 
 63-@param weekend - [ OPTIONAL - 1 by default ] - A number or string representing which days of the week are considered weekends. String method: weekends can be specified using seven 0’s and 1’s, where the first number in the et represents Monday and the last number is for Sunday. A zero means that the day is a work day, a 1 means that the day is a weekend. For example, “0000011” would mean Saturday and Sunday are weekends. Number method: instead of using the string method above, a single number can be used. 1 = SaturdaySunday are weekends, 2 = SundayMonday, and this pattern repeats until 7 = FridaySaturday. 11 = Sunday is the only weekend, 12 = Monday is the only weekend, and this pattern repeats until 17 = Saturday is the only weekend. 
 64+@param weekend - [ OPTIONAL - 1 by default ] - A number or string representing which days of the week are considered weekends. String method: weekends can be specified using seven 0’s and 1’s, where the first number in the et represents Monday and the last number is for Sunday. A zero means that the day is a work day, a 1 means that the day is a weekend. For example, “0000011” would mean Saturday and Sunday are weekends. Number method: instead of using the string method above, a single number can be used. 1 = Saturday/Sunday are weekends, 2 = Sunday/Monday, and this pattern repeats until 7 = Friday/Saturday. 11 = Sunday is the only weekend, 12 = Monday is the only weekend, and this pattern repeats until 17 = Saturday is the only weekend. 
 65 @param holidays - [ OPTIONAL ] - A range or array constant containing the dates to consider holidays. 
 66 @returns {number} 
 67 @constructor
 68@@ -394,7 +394,7 @@
 69 ```
 70   Converts a price quotation given as a decimal fraction into a decimal value. 
 71 @param fractionalPrice - The price quotation given using fractional decimal conventions. 
 72-@param unit - The units of the fraction, e.g. 8 for 18ths or 32 for 132nds. 
 73+@param unit - The units of the fraction, e.g. 8 for 1/8ths or 32 for 1/32nds. 
 74 @returns {number} decimal value. 
 75 @constructor
 76 ```
 77@@ -404,7 +404,7 @@
 78 ```
 79   Converts a price quotation given as a decimal value into a decimal fraction. 
 80 @param decimalPrice - The price quotation given as a decimal value. 
 81-@param unit - The units of the desired fraction, e.g. 8 for 18ths or 32 for 132nds 
 82+@param unit - The units of the desired fraction, e.g. 8 for 1/8ths or 32 for 1/32nds 
 83 @returns {number} price quotation as decimal fraction. 
 84 @constructor
 85 ```
 86@@ -476,14 +476,14 @@
 87 ### ACCRINT 
 88 
 89 ```
 90-  Calculates the accrued interest of a security that has periodic payments. WARNING: This function has been implemented to specifications as outlined in Google Spreadsheets, LibreOffice, and OpenOffice. It functions much the same as MSExcel's ACCRINT, but there are several key differences. Below are links to illustrate the differences. Please see the source code for more information on differences. Links: https:quant.stackexchange.comquestion7040whats-the-algorithm-behind-excels-accrint, https:upport.office.comen-uarticleACCRINT-function-fe45d089-6722-4fb3-9379-e1f911d8dc74, https:quant.stackexchange.comquestion7040whats-the-algorithm-behind-excels-accrint, https:upport.google.comdocanswer3093200 . 
 91+  Calculates the accrued interest of a security that has periodic payments. WARNING: This function has been implemented to specifications as outlined in Google Spreadsheets, LibreOffice, and OpenOffice. It functions much the same as MSExcel's ACCRINT, but there are several key differences. Below are links to illustrate the differences. Please see the source code for more information on differences. Links: https://quant.stackexchange.com/questions/7040/whats-the-algorithm-behind-excels-accrint, https://support.office.com/en-us/article/ACCRINT-function-fe45d089-6722-4fb3-9379-e1f911d8dc74, https://quant.stackexchange.com/questions/7040/whats-the-algorithm-behind-excels-accrint, https://support.google.com/docs/answer/3093200 . 
 92 @param issue - The date the security was initially issued. 
 93 @param firstPayment - The first date interest will be paid. 
 94 @param settlement - The settlement date of the security, the date after issuance when the security is delivered to the buyer. Is the maturity date of the security if it is held until maturity rather than sold. 
 95 @param rate - The annualized rate of interest. 
 96 @param redemption - The redemption amount per 100 face value, or par. 
 97 @param frequency - The number of coupon payments per year. For annual payments, frequency = 1; for emiannual, frequency = 2; for quarterly, frequency = 4. 
 98-@param dayCountConvention - [ OPTIONAL - 0 by default ] - An indicator of what day count method to use. 0 or omitted = US (NASD) 30360, 1 = Actualactual, 2 = Actual360, 3 = Actual365, 4 = European 30360. 
 99+@param dayCountConvention - [ OPTIONAL - 0 by default ] - An indicator of what day count method to use. 0 or omitted = US (NASD) 30/360, 1 = Actual/actual, 2 = Actual/360, 3 = Actual/365, 4 = European 30/360. 
100 @returns {number} 
101 @constructor TODO: This function is based off of the open-source versions I was able to dig up online. We should implement a TODO:     second version that is closer to what MSExcel does and is named something like `ACCRINT.MS`.
102 ```
103@@ -558,7 +558,7 @@
104 ### IRR 
105 
106 ```
107-  Calculates the internal rate of return for an investment. The values represent cash flow values at regular intervals; at least one value must be negative (payments), and at least one value must be positive (income).  Relevant StackOverflow discussion: https:tackoverflow.comquestion15089151javascript-irr-internal-rate-of-return-formula-accuracy  
108+  Calculates the internal rate of return for an investment. The values represent cash flow values at regular intervals; at least one value must be negative (payments), and at least one value must be positive (income).  Relevant StackOverflow discussion: https://stackoverflow.com/questions/15089151/javascript-irr-internal-rate-of-return-formula-accuracy  
109 @param values - Range containing values. Ignores text values. 
110 @param guess - [OPTIONAL] - The estimated value. Defaults to 0.01. 
111 @returns {number} 
112@@ -598,7 +598,7 @@
113 ### NA 
114 
115 ```
116-  Returns the "value not available" error, "#NA". 
117+  Returns the "value not available" error, "#N/A". 
118 @constructor
119 ```
120 
121@@ -678,7 +678,7 @@
122 
123 ```
124   Returns the number corresponding to an error value occurring in a different cell. With the aid of this number, an error message text can be generated. If an error occurs, the function returns a logical or numerical value. 
125-@param value - Contains either the addrereference of the cell in which the error occurs, or the error directly. Eg: `=ERRORTYPE(NA())` 
126+@param value - Contains either the address/reference of the cell in which the error occurs, or the error directly. Eg: `=ERRORTYPE(NA())` 
127 @constructor
128 ```
129 
130@@ -694,8 +694,8 @@
131 ### ISERR 
132 
133 ```
134-  Returns TRUE if the value refers to any error value except #NA. You can use this function to control error values in certain cells. If an error occurs, the function returns a logical or numerical value. 
135-@param value - Any value or expression in which a test is performed to determine whether an error value not equal to #NA is present. 
136+  Returns TRUE if the value refers to any error value except #N/A. You can use this function to control error values in certain cells. If an error occurs, the function returns a logical or numerical value. 
137+@param value - Any value or expression in which a test is performed to determine whether an error value not equal to #N/A is present. 
138 @returns {boolean} 
139 @constructor
140 ```
141@@ -703,7 +703,7 @@
142 ### ISERROR 
143 
144 ```
145-  Tests if the cells contain general error values. ISERROR recognizes the #NA error value. If an error occurs, the function returns a logical or numerical value. 
146+  Tests if the cells contain general error values. ISERROR recognizes the #N/A error value. If an error occurs, the function returns a logical or numerical value. 
147 @param value - is any value where a test is performed to determine whether it is an error value. 
148 @returns {boolean} 
149 @constructor
150@@ -712,7 +712,7 @@
151 ### ISNA 
152 
153 ```
154-  Returns TRUE if a cell contains the #NA (value not available) error value. If an error occurs, the function returns a logical or numerical value. 
155+  Returns TRUE if a cell contains the #N/A (value not available) error value. If an error occurs, the function returns a logical or numerical value. 
156 @param value - The value or expression to be tested. 
157 @returns {boolean} 
158 @constructor
159@@ -731,7 +731,7 @@
160 ### TYPE 
161 
162 ```
163-  Returns a number corresponding to the type of data passed into the function. 1 = number, 2 = text, 4 = boolean, 16 = error, 64 = arrayrange, 128 = any other type of cell. 
164+  Returns a number corresponding to the type of data passed into the function. 1 = number, 2 = text, 4 = boolean, 16 = error, 64 = array/range, 128 = any other type of cell. 
165 @param value - Value for which the type will be determined. 
166 @returns {number} 
167 @constructor
168@@ -1011,7 +1011,7 @@
169 ### SUM 
170 
171 ```
172-  Returns the sum of a series of numbers andor cells. 
173+  Returns the sum of a series of numbers and/or cells. 
174 @param values The first number or range to add together. 
175 @returns {number} The sum of the series 
176 @constructor
177@@ -1056,7 +1056,7 @@
178 ### COT 
179 
180 ```
181-  Returns the cotangent of any real number. Defined as cot(x) = 1  tan(x). 
182+  Returns the cotangent of any real number. Defined as cot(x) = 1 / tan(x). 
183 @param value - number to calculate the cotangent for 
184 @returns {number} cotangent 
185 @constructor
186@@ -1065,7 +1065,7 @@
187 ### COTH 
188 
189 ```
190-  Return the hyperbolic cotangent of a value, defined as coth(x) = 1  tanh(x). 
191+  Return the hyperbolic cotangent of a value, defined as coth(x) = 1 / tanh(x). 
192 @param value - value to calculate the hyperbolic cotangent value of 
193 @returns {number} hyperbolic cotangent 
194 @constructor
195@@ -1266,7 +1266,7 @@
196 ### SUMSQ 
197 
198 ```
199-  Returns the sum of the squares of a series of numbers andor cells. 
200+  Returns the sum of the squares of a series of numbers and/or cells. 
201 @param values  The values or range(s) whose squares to add together. 
202 @returns {number} the sum of the squares if the input. 
203 @constructor
204@@ -1353,10 +1353,10 @@
205 ### DIVIDE 
206 
207 ```
208-  Returns one number divided by another. Equivalent to the `` operator. 
209+  Returns one number divided by another. Equivalent to the `/` operator. 
210 @param dividend - The number to be divided. 
211 @param divisor - The number to divide by, cannot be 0. 
212-@returns {number} result of dividend  divisor. 
213+@returns {number} result of dividend / divisor. 
214 @constructor
215 ```
216 
217@@ -1371,7 +1371,7 @@
218 ### RANDBETWEEN 
219 
220 ```
221-  Returns a uniformly random integer between two values, inclusive on high and low. Values with decimal parts may be used for low andor high; this will cause the least and greatest possible values to be the next integer greater than low andor the next integer less than high, respectively. 
222+  Returns a uniformly random integer between two values, inclusive on high and low. Values with decimal parts may be used for low and/or high; this will cause the least and greatest possible values to be the next integer greater than low and/or the next integer less than high, respectively. 
223 @param low - lowest value 
224 @param high - highest value 
225 @returns {number} between low and high. 
226@@ -1570,7 +1570,7 @@
227 ### GROWTH 
228 
229 ```
230-  Given partial data with exponential growth, fits and ideal exponential growth trend, and predicts future values. For more information see: https:xkcd.com1102 
231+  Given partial data with exponential growth, fits and ideal exponential growth trend, and predicts future values. For more information see: https://xkcd.com/1102 
232 @param knownY - The range or array containing the dependent, y, values that are known, and will be used to fit an ideal exponential growth curve. 
233 @param knownX - OPTIONAL - The range or values of the independent variables that correspond to knownY. 
234 @param newX - OPTIONAL - The range, values, or data-points to return the y-values on the ideal curve fit. 
235diff --git a/TODO.md b/TODO.md
236index 932a931..bba2802 100644
237--- a/TODO.md
238+++ b/TODO.md
239@@ -13,9 +13,6 @@ For example 64 tbs to a qt.
240 For example `=#N/A` should force an error to be thrown inside the cell.
241 
242 
243-### Fix documentation regular expression, it is butchering URLs.
244-
245-
246 ### Parser/Sheet should be able to be initialized with js range notation (`[]`) or regular range notation (`{}`)
247 
248 
249diff --git a/docs.sh b/docs.sh
250index 18cf707..2671154 100755
251--- a/docs.sh
252+++ b/docs.sh
253@@ -21,7 +21,7 @@ function start_block() {
254 
255 function add_to_block() {
256   LINE="$1"
257-  LINE=$(echo "$LINE" | sed 's/\*\**//g' | sed 's/\s*\/\s*//g' | sed "s/^[ \s]*//")
258+  LINE=$(echo "$LINE" | sed 's/\*\**//g' | sed 's/^\s*\/\s*//g' | sed 's/\s*\/\s*$//g' | sed "s/^[ \s]*//")
259   CURRENT_BLOCK="${CURRENT_BLOCK}\n""$LINE"
260 }
261