oakscriptjs 0.11.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. package/dist/cjs/array/index.d.ts +8 -2
  2. package/dist/cjs/array/index.d.ts.map +1 -1
  3. package/dist/cjs/array/index.js +2 -1
  4. package/dist/cjs/array/index.js.map +2 -2
  5. package/dist/cjs/box/index.js +6 -6
  6. package/dist/cjs/box/index.js.map +2 -2
  7. package/dist/cjs/callsite/index.js +1 -1
  8. package/dist/cjs/callsite/index.js.map +2 -2
  9. package/dist/cjs/drawing/registry.d.ts +15 -6
  10. package/dist/cjs/drawing/registry.d.ts.map +1 -1
  11. package/dist/cjs/drawing/registry.js +16 -2
  12. package/dist/cjs/drawing/registry.js.map +2 -2
  13. package/dist/cjs/index.d.ts +3 -2
  14. package/dist/cjs/index.d.ts.map +1 -1
  15. package/dist/cjs/index.js +6 -1
  16. package/dist/cjs/index.js.map +2 -2
  17. package/dist/cjs/input.d.ts +9 -1
  18. package/dist/cjs/input.d.ts.map +1 -1
  19. package/dist/cjs/input.js +16 -0
  20. package/dist/cjs/input.js.map +2 -2
  21. package/dist/cjs/label/index.js +3 -3
  22. package/dist/cjs/label/index.js.map +2 -2
  23. package/dist/cjs/line/index.d.ts +10 -27
  24. package/dist/cjs/line/index.d.ts.map +1 -1
  25. package/dist/cjs/line/index.js +10 -27
  26. package/dist/cjs/line/index.js.map +2 -2
  27. package/dist/cjs/linefill/index.d.ts +3 -0
  28. package/dist/cjs/linefill/index.d.ts.map +1 -1
  29. package/dist/cjs/linefill/index.js +15 -1
  30. package/dist/cjs/linefill/index.js.map +3 -3
  31. package/dist/cjs/runtime/adapters/SimpleInputAdapter.js +1 -1
  32. package/dist/cjs/runtime/adapters/SimpleInputAdapter.js.map +2 -2
  33. package/dist/cjs/runtime/index.d.ts +1 -1
  34. package/dist/cjs/runtime/index.d.ts.map +1 -1
  35. package/dist/cjs/runtime/index.js +1 -0
  36. package/dist/cjs/runtime/index.js.map +2 -2
  37. package/dist/cjs/runtime/inputs.d.ts +9 -0
  38. package/dist/cjs/runtime/inputs.d.ts.map +1 -1
  39. package/dist/cjs/runtime/inputs.js +8 -0
  40. package/dist/cjs/runtime/inputs.js.map +2 -2
  41. package/dist/cjs/runtime/types.d.ts +1 -1
  42. package/dist/cjs/runtime/types.d.ts.map +1 -1
  43. package/dist/cjs/runtime/types.js.map +1 -1
  44. package/dist/cjs/script/index.d.ts +65 -12
  45. package/dist/cjs/script/index.d.ts.map +1 -1
  46. package/dist/cjs/script/index.js +168 -19
  47. package/dist/cjs/script/index.js.map +3 -3
  48. package/dist/cjs/security/other.d.ts +92 -0
  49. package/dist/cjs/security/other.d.ts.map +1 -0
  50. package/dist/cjs/security/other.js +164 -0
  51. package/dist/cjs/security/other.js.map +7 -0
  52. package/dist/cjs/session/bars.d.ts +10 -1
  53. package/dist/cjs/session/bars.d.ts.map +1 -1
  54. package/dist/cjs/session/bars.js +16 -2
  55. package/dist/cjs/session/bars.js.map +2 -2
  56. package/dist/cjs/session/calendar.d.ts +4 -1
  57. package/dist/cjs/session/calendar.d.ts.map +1 -1
  58. package/dist/cjs/session/calendar.js +11 -7
  59. package/dist/cjs/session/calendar.js.map +2 -2
  60. package/dist/cjs/session/context.d.ts +2 -1
  61. package/dist/cjs/session/context.d.ts.map +1 -1
  62. package/dist/cjs/session/context.js +2 -1
  63. package/dist/cjs/session/context.js.map +2 -2
  64. package/dist/cjs/str/floatingdecimal.d.ts +31 -0
  65. package/dist/cjs/str/floatingdecimal.d.ts.map +1 -0
  66. package/dist/cjs/str/floatingdecimal.js +298 -0
  67. package/dist/cjs/str/floatingdecimal.js.map +7 -0
  68. package/dist/cjs/str/index.d.ts +4 -3
  69. package/dist/cjs/str/index.d.ts.map +1 -1
  70. package/dist/cjs/str/index.js +1 -1
  71. package/dist/cjs/str/index.js.map +2 -2
  72. package/dist/cjs/str/numberformat.d.ts +6 -4
  73. package/dist/cjs/str/numberformat.d.ts.map +1 -1
  74. package/dist/cjs/str/numberformat.js +3 -2
  75. package/dist/cjs/str/numberformat.js.map +2 -2
  76. package/dist/cjs/ta/index.d.ts +34 -17
  77. package/dist/cjs/ta/index.d.ts.map +1 -1
  78. package/dist/cjs/ta/index.js +132 -116
  79. package/dist/cjs/ta/index.js.map +2 -2
  80. package/dist/cjs/ta/limits.d.ts +11 -0
  81. package/dist/cjs/ta/limits.d.ts.map +1 -1
  82. package/dist/cjs/ta/limits.js +15 -1
  83. package/dist/cjs/ta/limits.js.map +2 -2
  84. package/dist/cjs/ta/running-sum.js +1 -1
  85. package/dist/cjs/ta/running-sum.js.map +2 -2
  86. package/dist/cjs/ta-series.d.ts +1 -1
  87. package/dist/cjs/ta-series.d.ts.map +1 -1
  88. package/dist/cjs/ta-series.js +1 -1
  89. package/dist/cjs/ta-series.js.map +2 -2
  90. package/dist/cjs/table/index.d.ts +3 -1
  91. package/dist/cjs/table/index.d.ts.map +1 -1
  92. package/dist/cjs/table/index.js +1 -0
  93. package/dist/cjs/table/index.js.map +3 -3
  94. package/dist/cjs/time/session.d.ts +9 -0
  95. package/dist/cjs/time/session.d.ts.map +1 -1
  96. package/dist/cjs/time/session.js +42 -14
  97. package/dist/cjs/time/session.js.map +3 -3
  98. package/dist/cjs/time/timezone.d.ts +6 -1
  99. package/dist/cjs/time/timezone.d.ts.map +1 -1
  100. package/dist/cjs/time/timezone.js +2 -2
  101. package/dist/cjs/time/timezone.js.map +2 -2
  102. package/dist/cjs/types/metadata.d.ts +1 -1
  103. package/dist/cjs/types/metadata.d.ts.map +1 -1
  104. package/dist/cjs/types/metadata.js.map +1 -1
  105. package/dist/esm/array/index.d.ts +8 -2
  106. package/dist/esm/array/index.d.ts.map +1 -1
  107. package/dist/esm/array/index.js +12 -3
  108. package/dist/esm/array/index.js.map +1 -1
  109. package/dist/esm/box/index.js +6 -6
  110. package/dist/esm/box/index.js.map +1 -1
  111. package/dist/esm/callsite/index.js +1 -1
  112. package/dist/esm/callsite/index.js.map +1 -1
  113. package/dist/esm/drawing/registry.d.ts +15 -6
  114. package/dist/esm/drawing/registry.d.ts.map +1 -1
  115. package/dist/esm/drawing/registry.js +30 -7
  116. package/dist/esm/drawing/registry.js.map +1 -1
  117. package/dist/esm/index.d.ts +3 -2
  118. package/dist/esm/index.d.ts.map +1 -1
  119. package/dist/esm/index.js +4 -2
  120. package/dist/esm/index.js.map +1 -1
  121. package/dist/esm/input.d.ts +9 -1
  122. package/dist/esm/input.d.ts.map +1 -1
  123. package/dist/esm/input.js +16 -0
  124. package/dist/esm/input.js.map +1 -1
  125. package/dist/esm/label/index.js +3 -3
  126. package/dist/esm/label/index.js.map +1 -1
  127. package/dist/esm/line/index.d.ts +10 -27
  128. package/dist/esm/line/index.d.ts.map +1 -1
  129. package/dist/esm/line/index.js +20 -64
  130. package/dist/esm/line/index.js.map +1 -1
  131. package/dist/esm/linefill/index.d.ts +3 -0
  132. package/dist/esm/linefill/index.d.ts.map +1 -1
  133. package/dist/esm/linefill/index.js +20 -1
  134. package/dist/esm/linefill/index.js.map +1 -1
  135. package/dist/esm/runtime/adapters/SimpleInputAdapter.js +1 -1
  136. package/dist/esm/runtime/adapters/SimpleInputAdapter.js.map +1 -1
  137. package/dist/esm/runtime/index.d.ts +1 -1
  138. package/dist/esm/runtime/index.d.ts.map +1 -1
  139. package/dist/esm/runtime/index.js +1 -1
  140. package/dist/esm/runtime/index.js.map +1 -1
  141. package/dist/esm/runtime/inputs.d.ts +9 -0
  142. package/dist/esm/runtime/inputs.d.ts.map +1 -1
  143. package/dist/esm/runtime/inputs.js +15 -0
  144. package/dist/esm/runtime/inputs.js.map +1 -1
  145. package/dist/esm/runtime/types.d.ts +1 -1
  146. package/dist/esm/runtime/types.d.ts.map +1 -1
  147. package/dist/esm/script/index.d.ts +65 -12
  148. package/dist/esm/script/index.d.ts.map +1 -1
  149. package/dist/esm/script/index.js +217 -29
  150. package/dist/esm/script/index.js.map +1 -1
  151. package/dist/esm/security/other.d.ts +92 -0
  152. package/dist/esm/security/other.d.ts.map +1 -0
  153. package/dist/esm/security/other.js +211 -0
  154. package/dist/esm/security/other.js.map +1 -0
  155. package/dist/esm/session/bars.d.ts +10 -1
  156. package/dist/esm/session/bars.d.ts.map +1 -1
  157. package/dist/esm/session/bars.js +26 -1
  158. package/dist/esm/session/bars.js.map +1 -1
  159. package/dist/esm/session/calendar.d.ts +4 -1
  160. package/dist/esm/session/calendar.d.ts.map +1 -1
  161. package/dist/esm/session/calendar.js +19 -7
  162. package/dist/esm/session/calendar.js.map +1 -1
  163. package/dist/esm/session/context.d.ts +2 -1
  164. package/dist/esm/session/context.d.ts.map +1 -1
  165. package/dist/esm/session/context.js +5 -3
  166. package/dist/esm/session/context.js.map +1 -1
  167. package/dist/esm/str/floatingdecimal.d.ts +31 -0
  168. package/dist/esm/str/floatingdecimal.d.ts.map +1 -0
  169. package/dist/esm/str/floatingdecimal.js +272 -0
  170. package/dist/esm/str/floatingdecimal.js.map +1 -0
  171. package/dist/esm/str/index.d.ts +4 -3
  172. package/dist/esm/str/index.d.ts.map +1 -1
  173. package/dist/esm/str/index.js +6 -5
  174. package/dist/esm/str/index.js.map +1 -1
  175. package/dist/esm/str/numberformat.d.ts +6 -4
  176. package/dist/esm/str/numberformat.d.ts.map +1 -1
  177. package/dist/esm/str/numberformat.js +9 -5
  178. package/dist/esm/str/numberformat.js.map +1 -1
  179. package/dist/esm/ta/index.d.ts +34 -17
  180. package/dist/esm/ta/index.d.ts.map +1 -1
  181. package/dist/esm/ta/index.js +155 -185
  182. package/dist/esm/ta/index.js.map +1 -1
  183. package/dist/esm/ta/limits.d.ts +11 -0
  184. package/dist/esm/ta/limits.d.ts.map +1 -1
  185. package/dist/esm/ta/limits.js +27 -2
  186. package/dist/esm/ta/limits.js.map +1 -1
  187. package/dist/esm/ta/running-sum.js +1 -1
  188. package/dist/esm/ta/running-sum.js.map +1 -1
  189. package/dist/esm/ta-series.d.ts +1 -1
  190. package/dist/esm/ta-series.d.ts.map +1 -1
  191. package/dist/esm/ta-series.js +2 -1
  192. package/dist/esm/ta-series.js.map +1 -1
  193. package/dist/esm/table/index.d.ts +3 -1
  194. package/dist/esm/table/index.d.ts.map +1 -1
  195. package/dist/esm/table/index.js +6 -1
  196. package/dist/esm/table/index.js.map +1 -1
  197. package/dist/esm/time/session.d.ts +9 -0
  198. package/dist/esm/time/session.d.ts.map +1 -1
  199. package/dist/esm/time/session.js +53 -15
  200. package/dist/esm/time/session.js.map +1 -1
  201. package/dist/esm/time/timezone.d.ts +6 -1
  202. package/dist/esm/time/timezone.d.ts.map +1 -1
  203. package/dist/esm/time/timezone.js +8 -2
  204. package/dist/esm/time/timezone.js.map +1 -1
  205. package/dist/esm/types/metadata.d.ts +1 -1
  206. package/dist/esm/types/metadata.d.ts.map +1 -1
  207. package/package.json +1 -1
  208. package/src/array/index.ts +11 -3
  209. package/src/box/index.ts +6 -6
  210. package/src/callsite/index.ts +1 -1
  211. package/src/drawing/registry.ts +30 -7
  212. package/src/index.ts +11 -1
  213. package/src/input.ts +18 -1
  214. package/src/label/index.ts +3 -3
  215. package/src/line/index.ts +20 -68
  216. package/src/linefill/index.ts +20 -1
  217. package/src/runtime/adapters/SimpleInputAdapter.ts +1 -1
  218. package/src/runtime/index.ts +1 -0
  219. package/src/runtime/inputs.ts +16 -0
  220. package/src/runtime/types.ts +1 -1
  221. package/src/script/index.ts +292 -30
  222. package/src/security/other.ts +269 -0
  223. package/src/session/bars.ts +24 -1
  224. package/src/session/calendar.ts +23 -7
  225. package/src/session/context.ts +5 -3
  226. package/src/str/floatingdecimal.ts +268 -0
  227. package/src/str/index.ts +6 -5
  228. package/src/str/numberformat.ts +11 -6
  229. package/src/ta/index.ts +157 -183
  230. package/src/ta/limits.ts +28 -1
  231. package/src/ta/running-sum.ts +1 -1
  232. package/src/ta-series.ts +3 -2
  233. package/src/table/index.ts +4 -1
  234. package/src/time/session.ts +58 -16
  235. package/src/time/timezone.ts +9 -2
  236. package/src/types/metadata.ts +1 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/str/index.ts"],
4
- "sourcesContent": ["/**\n * String namespace\n * Mirrors PineScript's str.* functions for string manipulation and analysis.\n *\n * @remarks\n * All string functions in this namespace follow PineScript v6 API specifications.\n * String operations are case-sensitive unless otherwise specified.\n *\n * @version 6\n */\n\nimport { formatNumber, tickScale } from './numberformat.js';\nimport { formatMessage } from './messageformat.js';\nimport { formatDate } from './dateformat.js';\nimport type { int, bool, float, simple_int, simple_string } from '../types/index.js';\n\n/**\n * Returns the length of a string.\n *\n * @param str - The string to measure\n * @returns The number of characters in the string\n *\n * @example\n * ```typescript\n * str.length(\"Hello\") // Returns: 5\n * str.length(\"\") // Returns: 0\n * ```\n */\nexport function length(str: simple_string): int {\n return str.length;\n}\n\n/**\n * Converts a value to its string representation (PineScript `str.tostring`).\n *\n * @param value - The value to convert (number, boolean, string, etc.)\n * @param format - Optional number format: a pattern (\"#.##\", \"#,###.00\", \"0.00%\", \"0.00E0\", \"#.##;(#.##)\") or\n * `format.percent` (\"percent\"), `format.volume` (\"volume\"), `format.mintick` (\"mintick\"),\n * `format.price` / `format.inherit`\n * @param mintick - Tick size for `format.mintick` (PineScript `syminfo.mintick`, implicit there). Not part of the\n * PineScript signature: the core function cannot see the chart, so pass it, as for `math.round_to_mintick`\n * @param pricescale - Price scale of the symbol for `format.mintick` (PineScript `syminfo.pricescale`), needed for a\n * symbol priced in fractions (32 for a 1/32 tick). Default: 10^(decimals of `mintick`)\n * @returns String representation of the value\n *\n * @remarks\n * As in PineScript:\n * - without format, numbers show up to 10 decimals (\"0.3333333333\"), rounded on the exact value of the double\n * (82325.10000000005 gives \"82325.1\"; with the format \"#.##########\" it gives \"82325.1000000001\"); 1e21 and more\n * use \"1E21\"\n * - patterns round half away from zero on the shortest decimal form: 1.005 with \"#.##\" gives \"1.01\";\n * at most 16 decimals from 1e-3 up (0.0012345678901234567 with 20 '#' decimals gives \"0.0012345678901235\")\n * - \"pos;neg\" patterns: a negative number takes the text of the negative subpattern (\"#.##;(#.##)\": \"(3.5)\")\n * - \"#\" is an optional digit (\"1.5\" with \"#.##\"), \"0\" a required digit (\"1.50\" with \"0.00\"),\n * \",\" groups thousands, \"%\" multiplies by 100, 'text' is literal text\n * - `format.percent` shows 2 decimals and \"%\" without multiplying; `format.volume` uses K, M, B, T\n * - `format.price` and `format.inherit` give \"price1\" / \"inherit1\" in PineScript: they are patterns\n * without digit characters, and oakscriptjs does the same\n * - `format.mintick` shows floor(log10(pricescale)) decimals, zeros included (\"1.00\", \"0.40\" for tick 0.01), and\n * rounds in two steps, with mintick = minmove / pricescale: the double quotient `|x| / (1 / pricescale)` half away\n * from zero (140.355 / 0.01 = 14035.499999999998 gives \"140.35\", where `math.round_to_mintick` gives 140.36),\n * then `floor(units / minmove + 0.5)` ticks (tick 0.02: 0.005 gives \"0.02\", -0.01 gives \"0.00\"). With a\n * pricescale that is no power of 10 the tick value is then rounded half even to those decimals (1/32: 25.25 gives\n * \"25.2\", -0.02 gives \"-0.0\"). It throws without `mintick`\n * - na gives \"NaN\" (\"NaN%\" with `format.percent`); an infinity gives \"NaN\" too (\"NaN%\" for `format.percent`,\n * \"NaNT\" for `format.volume`), except `format.mintick`, which gives \"Infinity\" / \"-Infinity\"\n *\n * @example\n * ```typescript\n * str.tostring(123) // \"123\"\n * str.tostring(1.5, \"#.##\") // \"1.5\"\n * str.tostring(0.5, \"#.00\") // \".50\"\n * str.tostring(12345.678, format.volume) // \"12.346K\"\n * ```\n */\nexport function tostring(value: any, format?: simple_string, mintick?: float, pricescale?: float): string {\n // an array: \"[a, b]\", each element as a single value\n if (Array.isArray(value)) return '[' + value.map((v) => tostring(v, format, mintick, pricescale)).join(', ') + ']';\n if (typeof value !== 'number') return String(value);\n if (Number.isNaN(value)) return format === 'percent' ? 'NaN%' : 'NaN';\n if (!Number.isFinite(value)) {\n // the chart formatter has no infinity: NaN with the format's suffix\n if (format === 'mintick') return String(value);\n return format === 'percent' ? 'NaN%' : format === 'volume' ? 'NaNT' : 'NaN';\n }\n if (format === undefined || format === '') {\n if (Math.abs(value) >= 1e21 && Number.isFinite(value)) {\n return String(value).replace('e+', 'E').replace(/\\.0+E/, 'E');\n }\n // without a format the exact value is rounded (82325.10000000005 is 82325.10000000004947...: \"82325.1\")\n return formatNumber(value, '#.##########', 'halfUpExact');\n }\n switch (format) {\n case 'percent':\n return formatNumber(value, '0.00', 'halfUpShortest') + '%';\n case 'volume': {\n const abs = Math.abs(value);\n for (const [size, unit] of [[1e12, 'T'], [1e9, 'B'], [1e6, 'M'], [1e3, 'K']] as const) {\n if (abs >= size) return formatNumber(value / size, '#.###', 'halfUpShortest') + unit;\n }\n return formatNumber(value, '#', 'halfUpShortest');\n }\n case 'mintick': {\n if (mintick === undefined) {\n throw new Error('str.tostring(x, format.mintick) needs the tick size: pass it as str.tostring(x, format.mintick, syminfo.mintick)');\n }\n const [minmove, scale] = tickScale(mintick, pricescale);\n const decimals = Math.floor(Math.log10(scale) + 1e-9);\n const mask = decimals > 0 ? '0.' + '0'.repeat(decimals) : '0';\n if (!(minmove >= 1)) return formatNumber(value, mask, 'halfUpShortest');\n // 1. the double quotient |x| / (1 / pricescale), half away from zero (not math.round_to_mintick's exact decimal)\n const scaled = Math.abs(value) / (1 / scale);\n let units = Math.trunc(scaled);\n if (scaled - units >= 0.5) units++;\n // 2. to the tick, a half going up (minmove 2: -0.01 gives \"0.00\", 0.01 gives \"0.02\")\n const ticks = Math.floor((value < 0 ? -units : units) / minmove + 0.5);\n // 3. the tick value at the scale's decimals; a negative one keeps its sign when it prints as zero (\"-0.0\")\n const text = formatNumber((Math.abs(ticks) * minmove) / scale, mask, 'halfEvenExact');\n return ticks < 0 ? '-' + text : text;\n }\n default:\n return formatNumber(value, format, 'halfUpShortest');\n }\n}\n\n/**\n * Converts a string to a number (float).\n *\n * @param str - The string to convert\n * @returns The numeric value, or null (na) if conversion fails\n *\n * @remarks\n * As in PineScript:\n * - The whole text must be a number: a sign, digits and one optional \".\" (\"0.5\", \".5\", \"5.\", \"-12\"); \"12abc\" is na\n * - Scientific notation (\"1e3\"), \"Infinity\", \"NaN\", hexadecimal, \"1,000\" give na\n * - The characters U+0000 to U+0020 (space, tab, line feed...) around the number are ignored; other spaces\n * (no-break space U+00A0, U+3000) give na\n *\n * @example\n * ```typescript\n * str.tonumber(\"123\") // Returns: 123\n * str.tonumber(\"45.67\") // Returns: 45.67\n * str.tonumber(\"abc\") // Returns: null\n * str.tonumber(\"12abc\") // Returns: null\n * str.tonumber(\"1e3\") // Returns: null\n * ```\n */\nexport function tonumber(str: simple_string): float | null {\n // remove the characters U+0000..U+0020 at both ends\n let start = 0;\n let end = str.length;\n while (start < end && str.charCodeAt(start) <= 0x20) start++;\n while (end > start && str.charCodeAt(end - 1) <= 0x20) end--;\n const text = str.slice(start, end);\n if (!/^[+-]?(?:\\d+\\.?\\d*|\\.\\d+)$/.test(text)) return null;\n return parseFloat(text);\n}\n\n/**\n * Extracts a substring from a string.\n *\n * @param str - The source string\n * @param begin - Starting index (0-based, inclusive)\n * @param end - Ending index (0-based, exclusive). If omitted, extracts to end of string\n * @returns The extracted substring\n *\n * @remarks\n * - An na `end` (NaN / null) is a runtime error in PineScript: it throws\n * - If begin > end, indices are swapped (JavaScript behavior)\n * - Negative indices are treated as 0\n * - Indices beyond string length return empty string\n *\n * @example\n * ```typescript\n * str.substring(\"hello world\", 0, 5) // Returns: \"hello\"\n * str.substring(\"hello world\", 6) // Returns: \"world\"\n * str.substring(\"test\", 1, 3) // Returns: \"es\"\n * ```\n */\nexport function substring(str: simple_string, begin: simple_int, end?: simple_int): string {\n if (end === null || Number.isNaN(end)) throw new Error('str.substring: the end position is na');\n return str.substring(begin, end);\n}\n\n/**\n * Converts all characters in a string to uppercase.\n *\n * @param str - The string to convert\n * @returns The uppercase string\n *\n * @example\n * ```typescript\n * str.upper(\"hello\") // Returns: \"HELLO\"\n * str.upper(\"Hello World\") // Returns: \"HELLO WORLD\"\n * str.upper(\"test123\") // Returns: \"TEST123\"\n * ```\n */\nexport function upper(str: simple_string): string {\n return str.toUpperCase();\n}\n\n/**\n * Converts all characters in a string to lowercase.\n *\n * @param str - The string to convert\n * @returns The lowercase string\n *\n * @example\n * ```typescript\n * str.lower(\"HELLO\") // Returns: \"hello\"\n * str.lower(\"Hello World\") // Returns: \"hello world\"\n * str.lower(\"TEST123\") // Returns: \"test123\"\n * ```\n */\nexport function lower(str: simple_string): string {\n return str.toLowerCase();\n}\n\n/**\n * Checks if a string contains a substring.\n *\n * @param source - The string to search in\n * @param str - The substring to search for\n * @returns True if source contains str, false otherwise\n *\n * @remarks\n * - Search is case-sensitive\n * - Empty string is contained in any string\n *\n * @example\n * ```typescript\n * str.contains(\"hello world\", \"world\") // Returns: true\n * str.contains(\"hello world\", \"World\") // Returns: false (case-sensitive)\n * str.contains(\"test\", \"xyz\") // Returns: false\n * ```\n */\nexport function contains(source: simple_string, str: simple_string): bool {\n return source.includes(str);\n}\n\n/**\n * Returns the position of the first occurrence of a substring.\n *\n * @param source - The string to search in\n * @param str - The substring to search for\n * @returns The 0-based index of the first occurrence, or na (NaN) if not found\n *\n * @remarks\n * - Search is case-sensitive\n * - Returns 0 for empty search string\n * - Returns na (NaN) if substring is not found, as in PineScript\n *\n * @example\n * ```typescript\n * str.pos(\"hello world\", \"world\") // Returns: 6\n * str.pos(\"hello world\", \"o\") // Returns: 4 (first occurrence)\n * str.pos(\"hello\", \"xyz\") // Returns: NaN (na)\n * ```\n */\nexport function pos(source: simple_string, str: simple_string): int {\n const index = source.indexOf(str);\n return index === -1 ? NaN : index;\n}\n\n/**\n * Replaces the Nth occurrence of a substring (PineScript `str.replace`).\n *\n * @param source - The source string\n * @param target - The substring to replace\n * @param replacement - The string to replace with\n * @param occurrence - 0-based occurrence to replace (default 0, the first one)\n * @returns The string with one occurrence replaced\n *\n * @remarks\n * PineScript rules:\n * - only the Nth occurrence is replaced; an na occurrence is 0 (`str.replace(\"aaa\", \"a\", \"-\", na)` is \"-aa\")\n * - occurrences overlap: \"aa\" occurs at 0 and 1 in \"aaa\" (`str.replace(\"aaa\", \"aa\", \"-\", 1)` is \"a-\")\n * - an empty target inserts the replacement at character N, at most at the end\n * (`str.replace(\"abc\", \"\", \"-\", 2)` is \"ab-c\")\n * - fewer than N + 1 occurrences (or a negative N) leave the source unchanged\n *\n * @example\n * ```typescript\n * str.replace(\"hello world hello\", \"hello\", \"hi\") // Returns: \"hi world hello\"\n * str.replace(\"hello world hello\", \"hello\", \"hi\", 1) // Returns: \"hello world hi\"\n * str.replace(\"test\", \"xyz\", \"abc\") // Returns: \"test\"\n * ```\n */\nexport function replace(source: simple_string, target: simple_string, replacement: simple_string, occurrence: simple_int = 0): string {\n const n = occurrence === null || Number.isNaN(occurrence) ? 0 : Math.trunc(occurrence);\n if (n < 0) return source;\n let index: number;\n if (target === '') {\n index = Math.min(n, source.length);\n } else {\n index = -1;\n for (let k = 0; k <= n; k++) {\n index = source.indexOf(target, index + 1);\n if (index === -1) return source;\n }\n }\n return source.slice(0, index) + replacement + source.slice(index + target.length);\n}\n\n/**\n * Replaces all occurrences of a target string with a replacement string.\n *\n * @param source - The source string\n * @param target - The substring to find\n * @param replacement - The replacement string\n * @returns String with all occurrences replaced\n *\n * @remarks\n * - Replaces all occurrences of the target string\n * - Case sensitive\n * - If target is empty string, returns original string\n * - This matches PineScript's `str.replace_all()` behavior\n *\n * @example\n * ```typescript\n * str.replace_all(\"hello world hello\", \"hello\", \"hi\") // Returns: \"hi world hi\"\n * str.replace_all(\"a-b-c\", \"-\", \"_\") // Returns: \"a_b_c\"\n * str.replace_all(\"test\", \"x\", \"y\") // Returns: \"test\" (no match)\n * ```\n */\nexport function replace_all(source: simple_string, target: simple_string, replacement: simple_string): string {\n return source.replaceAll(target, replacement);\n}\n\n/**\n * Splits a string into an array of substrings using a separator.\n *\n * @param str - The string to split\n * @param separator - The separator string\n * @returns Array of substrings\n *\n * @remarks\n * - Empty separator splits into individual characters; an empty string gives [\"\"] (also with \"\")\n * - If separator is not found, returns array with original string\n * - Consecutive separators create empty strings in result\n *\n * @example\n * ```typescript\n * str.split(\"a,b,c\", \",\") // Returns: [\"a\", \"b\", \"c\"]\n * str.split(\"hello\", \"\") // Returns: [\"h\", \"e\", \"l\", \"l\", \"o\"]\n * str.split(\"a,,b\", \",\") // Returns: [\"a\", \"\", \"b\"]\n * ```\n */\nexport function split(str: simple_string, separator: simple_string): string[] {\n // JavaScript gives [] for \"\".split(\"\"); PineScript gives [\"\"]\n return str === '' ? [''] : str.split(separator);\n}\n\n/**\n * Concatenates multiple strings into one.\n *\n * @param strings - Variable number of strings to concatenate\n * @returns The concatenated string\n *\n * @example\n * ```typescript\n * str.concat(\"hello\", \" \", \"world\") // Returns: \"hello world\"\n * str.concat(\"a\", \"b\", \"c\") // Returns: \"abc\"\n * str.concat(\"test\") // Returns: \"test\"\n * ```\n */\nexport function concat(...strings: simple_string[]): string {\n return strings.join('');\n}\n\n/**\n * Formats a string with placeholders (PineScript `str.format`, Java MessageFormat syntax).\n *\n * @param formatStr - Pattern with `{0}`, `{1,number,#.##}`, `{0,number,percent}`, `{0,date,yyyy-MM-dd}`...\n * @param args - Values for the placeholders\n * @returns Formatted string\n *\n * @remarks\n * As in PineScript: numbers in `{n}` use\n * \"#,##0.###\" (1234.5678 gives \"1,234.568\"); number patterns round half to even on the exact\n * value (16 decimals at most from 1e-3 up); an array gives \"[a, b]\"; `'...'` is literal text and `''` a quote;\n * a missing argument leaves `{n}` in the text.\n * Dates are formatted in UTC here; PineScript uses the exchange time zone.\n *\n * @example\n * ```typescript\n * str.format('Close: {0,number,#.##}', 101.456) // \"Close: 101.46\"\n * str.format('{0} and {1}', 'a', 2) // \"a and 2\"\n * ```\n */\nexport function format(formatStr: simple_string, ...args: any[]): string {\n return formatMessage(formatStr, args, 'Etc/UTC');\n}\n\n/**\n * Checks if a string starts with a specific prefix.\n *\n * @param source - The string to check\n * @param str - The prefix to look for\n * @returns True if source starts with str, false otherwise\n *\n * @remarks\n * - Search is case-sensitive\n * - Empty string prefix always returns true\n *\n * @example\n * ```typescript\n * str.startswith(\"hello world\", \"hello\") // Returns: true\n * str.startswith(\"hello world\", \"Hello\") // Returns: false (case-sensitive)\n * str.startswith(\"test\", \"testing\") // Returns: false\n * ```\n */\nexport function startswith(source: simple_string, str: simple_string): bool {\n return source.startsWith(str);\n}\n\n/**\n * Checks if a string ends with a specific suffix.\n *\n * @param source - The string to check\n * @param str - The suffix to look for\n * @returns True if source ends with str, false otherwise\n *\n * @remarks\n * - Search is case-sensitive\n * - Empty string suffix always returns true\n *\n * @example\n * ```typescript\n * str.endswith(\"hello world\", \"world\") // Returns: true\n * str.endswith(\"hello world\", \"World\") // Returns: false (case-sensitive)\n * str.endswith(\"testing\", \"test\") // Returns: false\n * ```\n */\nexport function endswith(source: simple_string, str: simple_string): bool {\n return source.endsWith(str);\n}\n\n/**\n * Returns the character at a specific position in a string.\n *\n * @param str - The source string\n * @param pos - The 0-based position\n * @returns The character at the position, or empty string if out of bounds\n *\n * @remarks\n * - Returns empty string for negative or out-of-bounds positions\n * - Unicode characters may span multiple code units\n *\n * @example\n * ```typescript\n * str.charAt(\"hello\", 0) // Returns: \"h\"\n * str.charAt(\"hello\", 4) // Returns: \"o\"\n * str.charAt(\"hello\", 10) // Returns: \"\"\n * ```\n */\nexport function charAt(str: simple_string, pos: simple_int): string {\n return str.charAt(pos);\n}\n\n/**\n * Removes whitespace from both ends of a string.\n *\n * @param str - The string to trim\n * @returns The trimmed string\n *\n * @remarks\n * - Removes spaces, tabs, newlines, and other whitespace characters\n * - Preserves internal whitespace\n *\n * @example\n * ```typescript\n * str.trim(\" hello \") // Returns: \"hello\"\n * str.trim(\" hello world \") // Returns: \"hello world\"\n * str.trim(\"\\thello\\n\") // Returns: \"hello\"\n * ```\n */\nexport function trim(str: simple_string): string {\n return str.trim();\n}\n\n/**\n * Removes whitespace from the left (start) of a string.\n *\n * @param str - The string to trim\n * @returns The trimmed string\n *\n * @remarks\n * - Only removes leading whitespace\n * - Preserves trailing and internal whitespace\n *\n * @example\n * ```typescript\n * str.trimLeft(\" hello \") // Returns: \"hello \"\n * str.trimLeft(\" hello\") // Returns: \"hello\"\n * str.trimLeft(\"\\thello\") // Returns: \"hello\"\n * ```\n */\nexport function trimLeft(str: simple_string): string {\n return str.trimStart();\n}\n\n/**\n * Removes whitespace from the right (end) of a string.\n *\n * @param str - The string to trim\n * @returns The trimmed string\n *\n * @remarks\n * - Only removes trailing whitespace\n * - Preserves leading and internal whitespace\n *\n * @example\n * ```typescript\n * str.trimRight(\" hello \") // Returns: \" hello\"\n * str.trimRight(\"hello \") // Returns: \"hello\"\n * str.trimRight(\"hello\\t\") // Returns: \"hello\"\n * ```\n */\nexport function trimRight(str: simple_string): string {\n return str.trimEnd();\n}\n\n/**\n * Returns the first substring of `source` that matches the `regex` (PineScript `str.match`).\n *\n * @param source - Source string\n * @param regex - Regular expression\n * @returns The first match (searched anywhere in the string), or na (null) when nothing matches or the match is empty\n *\n * @remarks\n * - As PineScript: \"Hello World!\" with \"o\" gives \"o\", with \"[a-z]+\" gives \"ello\"; no match gives na\n * - Uses JavaScript regex syntax\n *\n * @example\n * ```typescript\n * str.match(\"abc123def\", \"[0-9]+\") // Returns: \"123\"\n * str.match(\"abc\", \"[0-9]+\") // Returns: null (na)\n * ```\n */\nexport function match(source: simple_string, regex: simple_string): simple_string | null {\n const found = new RegExp(regex).exec(source);\n return found && found[0] !== '' ? found[0] : null;\n}\n\n/**\n * Formats a timestamp as a string according to the specified format.\n *\n * @param time - Unix timestamp in milliseconds\n * @param format - Format string using PineScript format specifiers\n * @returns Formatted date/time string\n *\n * @remarks\n * Supported format specifiers (case-sensitive):\n * - `yyyy` - 4-digit year (e.g., \"2024\")\n * - `yy` - 2-digit year (e.g., \"24\")\n * - `MMMM` - Full month name (e.g., \"January\")\n * - `MMM` - Abbreviated month name (e.g., \"Jan\")\n * - `MM` - 2-digit month (01-12)\n * - `M` - Month (1-12)\n * - `dd` - 2-digit day (01-31)\n * - `d` - Day (1-31)\n * - `HH` - 2-digit hour (00-23)\n * - `H` - Hour (0-23)\n * - `hh` - 2-digit hour (01-12)\n * - `h` - Hour (1-12)\n * - `mm` - 2-digit minute (00-59)\n * - `m` - Minute (0-59)\n * - `ss` - 2-digit second (00-59)\n * - `s` - Second (0-59)\n * - `a` - AM/PM\n *\n * @example\n * ```typescript\n * const timestamp = 1609459200000; // Jan 1, 2021 00:00:00 UTC\n * str.format_time(timestamp, \"dd MMM yyyy\") // Returns: \"01 Jan 2021\"\n * str.format_time(timestamp, \"yyyy-MM-dd HH:mm:ss\") // Returns: \"2021-01-01 00:00:00\"\n * str.format_time(timestamp, \"MMM d, yyyy\") // Returns: \"Jan 1, 2021\"\n * str.format_time(timestamp, \"hh:mm a\") // Returns: \"12:00 AM\"\n * ```\n */\n/**\n * Constructs a new string containing the source string repeated N times with an optional separator.\n *\n * @param source - The string to repeat\n * @param count - Number of times to repeat\n * @param separator - String to inject between repeated instances. Optional, defaults to empty string.\n * @returns The repeated string, or null (na) if source is na or count is 0 / negative / na, as in PineScript\n *\n * @example\n * ```typescript\n * str.repeat(\"ab\", 3) // Returns: \"ababab\"\n * str.repeat(\"?\", 3, \",\") // Returns: \"?,?,?\"\n * str.repeat(\"hello\", 0) // Returns: null (na)\n * str.repeat(\"x\", 1) // Returns: \"x\"\n * ```\n */\nexport function repeat(source: simple_string, count: simple_int, separator: simple_string = ''): string | null {\n if (source == null) return null;\n if (!(count > 0)) return null; // 0, negative or na: na\n return Array(count).fill(source).join(separator);\n}\n\n/**\n * Formats a UNIX time (ms) with a date pattern (PineScript `str.format_time`).\n *\n * @param time - UNIX time in milliseconds\n * @param format - Java SimpleDateFormat pattern, e.g. \"yyyy-MM-dd HH:mm:ss\", \"dd MMM yyyy\", \"hh:mm a\"\n * @param timezone - UTC/GMT offset (\"UTC-5\") or IANA name (\"America/New_York\"). PineScript's default is\n * the exchange time zone, which is not known here: the default is UTC\n * @returns Formatted date string\n *\n * @remarks\n * Letters: y, M, d, E, u, D, w,\n * H, k, K, h, a, m, s, S, Z, z; 'text' is literal text.\n */\nexport function format_time(time: simple_int, format: simple_string = \"yyyy-MM-dd'T'HH:mm:ssZ\", timezone: simple_string = 'Etc/UTC'): string {\n return formatDate(time, format, timezone);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,0BAAwC;AACxC,2BAA8B;AAC9B,wBAA2B;AAepB,SAAS,OAAO,KAAyB;AAC9C,SAAO,IAAI;AACb;AA6CO,SAAS,SAAS,OAAYA,SAAwB,SAAiB,YAA4B;AAExG,MAAI,MAAM,QAAQ,KAAK,EAAG,QAAO,MAAM,MAAM,IAAI,CAAC,MAAM,SAAS,GAAGA,SAAQ,SAAS,UAAU,CAAC,EAAE,KAAK,IAAI,IAAI;AAC/G,MAAI,OAAO,UAAU,SAAU,QAAO,OAAO,KAAK;AAClD,MAAI,OAAO,MAAM,KAAK,EAAG,QAAOA,YAAW,YAAY,SAAS;AAChE,MAAI,CAAC,OAAO,SAAS,KAAK,GAAG;AAE3B,QAAIA,YAAW,UAAW,QAAO,OAAO,KAAK;AAC7C,WAAOA,YAAW,YAAY,SAASA,YAAW,WAAW,SAAS;AAAA,EACxE;AACA,MAAIA,YAAW,UAAaA,YAAW,IAAI;AACzC,QAAI,KAAK,IAAI,KAAK,KAAK,QAAQ,OAAO,SAAS,KAAK,GAAG;AACrD,aAAO,OAAO,KAAK,EAAE,QAAQ,MAAM,GAAG,EAAE,QAAQ,SAAS,GAAG;AAAA,IAC9D;AAEA,eAAO,kCAAa,OAAO,gBAAgB,aAAa;AAAA,EAC1D;AACA,UAAQA,SAAQ;AAAA,IACd,KAAK;AACH,iBAAO,kCAAa,OAA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;AAE5E,SAAO,QAAQ,KAAK,CAAC,EAAE,IAAI,IAAI,MAAM,SAAS;AAChD;AAeO,SAAS,UAAU,SAAkC;AAC1D,SAAO,QAAQ,KAAK,EAAE;AACxB;AAsBO,SAAS,OAAO,cAA6B,MAAqB;AACvE,aAAO,oCAAc,WAAW,MAAM,SAAS;AACjD;AAoBO,SAAS,WAAW,QAAuB,KAA0B;AAC1E,SAAO,OAAO,WAAW,GAAG;AAC9B;AAoBO,SAAS,SAAS,QAAuB,KAA0B;AACxE,SAAO,OAAO,SAAS,GAAG;AAC5B;AAoBO,SAAS,OAAO,KAAoBC,MAAyB;AAClE,SAAO,IAAI,OAAOA,IAAG;AACvB;AAmBO,SAAS,KAAK,KAA4B;AAC/C,SAAO,IAAI,KAAK;AAClB;AAmBO,SAAS,SAAS,KAA4B;AACnD,SAAO,IAAI,UAAU;AACvB;AAmBO,SAAS,UAAU,KAA4B;AACpD,SAAO,IAAI,QAAQ;AACrB;AAmBO,SAAS,MAAM,QAAuB,OAA4C;AACvF,QAAM,QAAQ,IAAI,OAAO,KAAK,EAAE,KAAK,MAAM;AAC3C,SAAO,SAAS,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI;AAC/C;AAsDO,SAAS,OAAO,QAAuB,OAAmB,YAA2B,IAAmB;AAC7G,MAAI,UAAU,KAAM,QAAO;AAC3B,MAAI,EAAE,QAAQ,GAAI,QAAO;AACzB,SAAO,MAAM,KAAK,EAAE,KAAK,MAAM,EAAE,KAAK,SAAS;AACjD;AAeO,SAAS,YAAY,MAAkBD,UAAwB,0BAA0B,WAA0B,WAAmB;AAC3I,aAAO,8BAAW,MAAMA,SAAQ,QAAQ;AAC1C;",
4
+ "sourcesContent": ["/**\n * String namespace\n * Mirrors PineScript's str.* functions for string manipulation and analysis.\n *\n * @remarks\n * All string functions in this namespace follow PineScript v6 API specifications.\n * String operations are case-sensitive unless otherwise specified.\n *\n * @version 6\n */\n\nimport { formatNumber, tickScale } from './numberformat.js';\nimport { formatMessage } from './messageformat.js';\nimport { formatDate } from './dateformat.js';\nimport type { int, bool, float, simple_int, simple_string } from '../types/index.js';\n\n/**\n * Returns the length of a string.\n *\n * @param str - The string to measure\n * @returns The number of characters in the string\n *\n * @example\n * ```typescript\n * str.length(\"Hello\") // Returns: 5\n * str.length(\"\") // Returns: 0\n * ```\n */\nexport function length(str: simple_string): int {\n return str.length;\n}\n\n/**\n * Converts a value to its string representation (PineScript `str.tostring`).\n *\n * @param value - The value to convert (number, boolean, string, etc.)\n * @param format - Optional number format: a pattern (\"#.##\", \"#,###.00\", \"0.00%\", \"0.00E0\", \"#.##;(#.##)\") or\n * `format.percent` (\"percent\"), `format.volume` (\"volume\"), `format.mintick` (\"mintick\"),\n * `format.price` / `format.inherit`\n * @param mintick - Tick size for `format.mintick` (PineScript `syminfo.mintick`, implicit there). Not part of the\n * PineScript signature: the core function cannot see the chart, so pass it, as for `math.round_to_mintick`\n * @param pricescale - Price scale of the symbol for `format.mintick` (PineScript `syminfo.pricescale`), needed for a\n * symbol priced in fractions (32 for a 1/32 tick). Default: 10^(decimals of `mintick`)\n * @returns String representation of the value\n *\n * @remarks\n * As in PineScript:\n * - without format, numbers show up to 10 decimals (\"0.3333333333\"): the digits of the JVM's binary to decimal\n * conversion, rounded half to even, a tie on the last converted digit decided by the conversion\n * (82325.10000000005 gives \"82325.1\", with the format \"#.##########\" \"82325.1000000001\"; 1791662400001 / 900000\n * gives \"1990736.000001111\"; 78195689105219552 keeps its 17 digits); 1e21 and more use \"1E21\"\n * - patterns round half away from zero on the shortest decimal form: 1.005 with \"#.##\" gives \"1.01\";\n * at most 16 decimals from 1e-3 up (0.0012345678901234567 with 20 '#' decimals gives \"0.0012345678901235\")\n * - \"pos;neg\" patterns: a negative number takes the text of the negative subpattern (\"#.##;(#.##)\": \"(3.5)\")\n * - \"#\" is an optional digit (\"1.5\" with \"#.##\"), \"0\" a required digit (\"1.50\" with \"0.00\"),\n * \",\" groups thousands, \"%\" multiplies by 100, 'text' is literal text\n * - `format.percent` shows 2 decimals and \"%\" without multiplying; `format.volume` uses K, M, B, T\n * - `format.price` and `format.inherit` give \"price1\" / \"inherit1\" in PineScript: they are patterns\n * without digit characters, and oakscriptjs does the same\n * - `format.mintick` shows floor(log10(pricescale)) decimals, zeros included (\"1.00\", \"0.40\" for tick 0.01), and\n * rounds in two steps, with mintick = minmove / pricescale: the double quotient `|x| / (1 / pricescale)` half away\n * from zero (140.355 / 0.01 = 14035.499999999998 gives \"140.35\", where `math.round_to_mintick` gives 140.36),\n * then `floor(units / minmove + 0.5)` ticks (tick 0.02: 0.005 gives \"0.02\", -0.01 gives \"0.00\"). With a\n * pricescale that is no power of 10 the tick value is then rounded half even to those decimals (1/32: 25.25 gives\n * \"25.2\", -0.02 gives \"-0.0\"). It throws without `mintick`\n * - na gives \"NaN\" (\"NaN%\" with `format.percent`); an infinity gives \"NaN\" too (\"NaN%\" for `format.percent`,\n * \"NaNT\" for `format.volume`), except `format.mintick`, which gives \"Infinity\" / \"-Infinity\"\n *\n * @example\n * ```typescript\n * str.tostring(123) // \"123\"\n * str.tostring(1.5, \"#.##\") // \"1.5\"\n * str.tostring(0.5, \"#.00\") // \".50\"\n * str.tostring(12345.678, format.volume) // \"12.346K\"\n * ```\n */\nexport function tostring(value: any, format?: simple_string, mintick?: float, pricescale?: float): string {\n // an array: \"[a, b]\", each element as a single value\n if (Array.isArray(value)) return '[' + value.map((v) => tostring(v, format, mintick, pricescale)).join(', ') + ']';\n if (typeof value !== 'number') return String(value);\n if (Number.isNaN(value)) return format === 'percent' ? 'NaN%' : 'NaN';\n if (!Number.isFinite(value)) {\n // the chart formatter has no infinity: NaN with the format's suffix\n if (format === 'mintick') return String(value);\n return format === 'percent' ? 'NaN%' : format === 'volume' ? 'NaNT' : 'NaN';\n }\n if (format === undefined || format === '') {\n if (Math.abs(value) >= 1e21 && Number.isFinite(value)) {\n return String(value).replace('e+', 'E').replace(/\\.0+E/, 'E');\n }\n // without a format: the digits of the JVM conversion, 10 decimals half to even (#171, #174)\n return formatNumber(value, '#.##########', 'halfEvenConverted');\n }\n switch (format) {\n case 'percent':\n return formatNumber(value, '0.00', 'halfUpShortest') + '%';\n case 'volume': {\n const abs = Math.abs(value);\n for (const [size, unit] of [[1e12, 'T'], [1e9, 'B'], [1e6, 'M'], [1e3, 'K']] as const) {\n if (abs >= size) return formatNumber(value / size, '#.###', 'halfUpShortest') + unit;\n }\n return formatNumber(value, '#', 'halfUpShortest');\n }\n case 'mintick': {\n if (mintick === undefined) {\n throw new Error('str.tostring(x, format.mintick) needs the tick size: pass it as str.tostring(x, format.mintick, syminfo.mintick)');\n }\n const [minmove, scale] = tickScale(mintick, pricescale);\n const decimals = Math.floor(Math.log10(scale) + 1e-9);\n const mask = decimals > 0 ? '0.' + '0'.repeat(decimals) : '0';\n if (!(minmove >= 1)) return formatNumber(value, mask, 'halfUpShortest');\n // 1. the double quotient |x| / (1 / pricescale), half away from zero (not math.round_to_mintick's exact decimal)\n const scaled = Math.abs(value) / (1 / scale);\n let units = Math.trunc(scaled);\n if (scaled - units >= 0.5) units++;\n // 2. to the tick, a half going up (minmove 2: -0.01 gives \"0.00\", 0.01 gives \"0.02\")\n const ticks = Math.floor((value < 0 ? -units : units) / minmove + 0.5);\n // 3. the tick value at the scale's decimals; a negative one keeps its sign when it prints as zero (\"-0.0\")\n const text = formatNumber((Math.abs(ticks) * minmove) / scale, mask, 'halfEvenExact');\n return ticks < 0 ? '-' + text : text;\n }\n default:\n return formatNumber(value, format, 'halfUpShortest');\n }\n}\n\n/**\n * Converts a string to a number (float).\n *\n * @param str - The string to convert\n * @returns The numeric value, or null (na) if conversion fails\n *\n * @remarks\n * As in PineScript:\n * - The whole text must be a number: a sign, digits and one optional \".\" (\"0.5\", \".5\", \"5.\", \"-12\"); \"12abc\" is na\n * - Scientific notation (\"1e3\"), \"Infinity\", \"NaN\", hexadecimal, \"1,000\" give na\n * - The characters U+0000 to U+0020 (space, tab, line feed...) around the number are ignored; other spaces\n * (no-break space U+00A0, U+3000) give na\n *\n * @example\n * ```typescript\n * str.tonumber(\"123\") // Returns: 123\n * str.tonumber(\"45.67\") // Returns: 45.67\n * str.tonumber(\"abc\") // Returns: null\n * str.tonumber(\"12abc\") // Returns: null\n * str.tonumber(\"1e3\") // Returns: null\n * ```\n */\nexport function tonumber(str: simple_string): float | null {\n // remove the characters U+0000..U+0020 at both ends\n let start = 0;\n let end = str.length;\n while (start < end && str.charCodeAt(start) <= 0x20) start++;\n while (end > start && str.charCodeAt(end - 1) <= 0x20) end--;\n const text = str.slice(start, end);\n if (!/^[+-]?(?:\\d+\\.?\\d*|\\.\\d+)$/.test(text)) return null;\n return parseFloat(text);\n}\n\n/**\n * Extracts a substring from a string.\n *\n * @param str - The source string\n * @param begin - Starting index (0-based, inclusive)\n * @param end - Ending index (0-based, exclusive). If omitted, extracts to end of string\n * @returns The extracted substring\n *\n * @remarks\n * - An na `end` (NaN / null) is a runtime error in PineScript: it throws\n * - If begin > end, indices are swapped (JavaScript behavior)\n * - Negative indices are treated as 0\n * - Indices beyond string length return empty string\n *\n * @example\n * ```typescript\n * str.substring(\"hello world\", 0, 5) // Returns: \"hello\"\n * str.substring(\"hello world\", 6) // Returns: \"world\"\n * str.substring(\"test\", 1, 3) // Returns: \"es\"\n * ```\n */\nexport function substring(str: simple_string, begin: simple_int, end?: simple_int): string {\n if (end === null || Number.isNaN(end)) throw new Error('str.substring: the end position is na');\n return str.substring(begin, end);\n}\n\n/**\n * Converts all characters in a string to uppercase.\n *\n * @param str - The string to convert\n * @returns The uppercase string\n *\n * @example\n * ```typescript\n * str.upper(\"hello\") // Returns: \"HELLO\"\n * str.upper(\"Hello World\") // Returns: \"HELLO WORLD\"\n * str.upper(\"test123\") // Returns: \"TEST123\"\n * ```\n */\nexport function upper(str: simple_string): string {\n return str.toUpperCase();\n}\n\n/**\n * Converts all characters in a string to lowercase.\n *\n * @param str - The string to convert\n * @returns The lowercase string\n *\n * @example\n * ```typescript\n * str.lower(\"HELLO\") // Returns: \"hello\"\n * str.lower(\"Hello World\") // Returns: \"hello world\"\n * str.lower(\"TEST123\") // Returns: \"test123\"\n * ```\n */\nexport function lower(str: simple_string): string {\n return str.toLowerCase();\n}\n\n/**\n * Checks if a string contains a substring.\n *\n * @param source - The string to search in\n * @param str - The substring to search for\n * @returns True if source contains str, false otherwise\n *\n * @remarks\n * - Search is case-sensitive\n * - Empty string is contained in any string\n *\n * @example\n * ```typescript\n * str.contains(\"hello world\", \"world\") // Returns: true\n * str.contains(\"hello world\", \"World\") // Returns: false (case-sensitive)\n * str.contains(\"test\", \"xyz\") // Returns: false\n * ```\n */\nexport function contains(source: simple_string, str: simple_string): bool {\n return source.includes(str);\n}\n\n/**\n * Returns the position of the first occurrence of a substring.\n *\n * @param source - The string to search in\n * @param str - The substring to search for\n * @returns The 0-based index of the first occurrence, or na (NaN) if not found\n *\n * @remarks\n * - Search is case-sensitive\n * - Returns 0 for empty search string\n * - Returns na (NaN) if substring is not found, as in PineScript\n *\n * @example\n * ```typescript\n * str.pos(\"hello world\", \"world\") // Returns: 6\n * str.pos(\"hello world\", \"o\") // Returns: 4 (first occurrence)\n * str.pos(\"hello\", \"xyz\") // Returns: NaN (na)\n * ```\n */\nexport function pos(source: simple_string, str: simple_string): int {\n const index = source.indexOf(str);\n return index === -1 ? NaN : index;\n}\n\n/**\n * Replaces the Nth occurrence of a substring (PineScript `str.replace`).\n *\n * @param source - The source string\n * @param target - The substring to replace\n * @param replacement - The string to replace with\n * @param occurrence - 0-based occurrence to replace (default 0, the first one)\n * @returns The string with one occurrence replaced\n *\n * @remarks\n * PineScript rules:\n * - only the Nth occurrence is replaced; an na occurrence is 0 (`str.replace(\"aaa\", \"a\", \"-\", na)` is \"-aa\")\n * - occurrences overlap: \"aa\" occurs at 0 and 1 in \"aaa\" (`str.replace(\"aaa\", \"aa\", \"-\", 1)` is \"a-\")\n * - an empty target inserts the replacement at character N, at most at the end\n * (`str.replace(\"abc\", \"\", \"-\", 2)` is \"ab-c\")\n * - fewer than N + 1 occurrences (or a negative N) leave the source unchanged\n *\n * @example\n * ```typescript\n * str.replace(\"hello world hello\", \"hello\", \"hi\") // Returns: \"hi world hello\"\n * str.replace(\"hello world hello\", \"hello\", \"hi\", 1) // Returns: \"hello world hi\"\n * str.replace(\"test\", \"xyz\", \"abc\") // Returns: \"test\"\n * ```\n */\nexport function replace(source: simple_string, target: simple_string, replacement: simple_string, occurrence: simple_int = 0): string {\n const n = occurrence === null || Number.isNaN(occurrence) ? 0 : Math.trunc(occurrence);\n if (n < 0) return source;\n let index: number;\n if (target === '') {\n index = Math.min(n, source.length);\n } else {\n index = -1;\n for (let k = 0; k <= n; k++) {\n index = source.indexOf(target, index + 1);\n if (index === -1) return source;\n }\n }\n return source.slice(0, index) + replacement + source.slice(index + target.length);\n}\n\n/**\n * Replaces all occurrences of a target string with a replacement string.\n *\n * @param source - The source string\n * @param target - The substring to find\n * @param replacement - The replacement string\n * @returns String with all occurrences replaced\n *\n * @remarks\n * - Replaces all occurrences of the target string\n * - Case sensitive\n * - If target is empty string, returns original string\n * - This matches PineScript's `str.replace_all()` behavior\n *\n * @example\n * ```typescript\n * str.replace_all(\"hello world hello\", \"hello\", \"hi\") // Returns: \"hi world hi\"\n * str.replace_all(\"a-b-c\", \"-\", \"_\") // Returns: \"a_b_c\"\n * str.replace_all(\"test\", \"x\", \"y\") // Returns: \"test\" (no match)\n * ```\n */\nexport function replace_all(source: simple_string, target: simple_string, replacement: simple_string): string {\n return source.replaceAll(target, replacement);\n}\n\n/**\n * Splits a string into an array of substrings using a separator.\n *\n * @param str - The string to split\n * @param separator - The separator string\n * @returns Array of substrings\n *\n * @remarks\n * - Empty separator splits into individual characters; an empty string gives [\"\"] (also with \"\")\n * - If separator is not found, returns array with original string\n * - Consecutive separators create empty strings in result\n *\n * @example\n * ```typescript\n * str.split(\"a,b,c\", \",\") // Returns: [\"a\", \"b\", \"c\"]\n * str.split(\"hello\", \"\") // Returns: [\"h\", \"e\", \"l\", \"l\", \"o\"]\n * str.split(\"a,,b\", \",\") // Returns: [\"a\", \"\", \"b\"]\n * ```\n */\nexport function split(str: simple_string, separator: simple_string): string[] {\n // JavaScript gives [] for \"\".split(\"\"); PineScript gives [\"\"]\n return str === '' ? [''] : str.split(separator);\n}\n\n/**\n * Concatenates multiple strings into one.\n *\n * @param strings - Variable number of strings to concatenate\n * @returns The concatenated string\n *\n * @example\n * ```typescript\n * str.concat(\"hello\", \" \", \"world\") // Returns: \"hello world\"\n * str.concat(\"a\", \"b\", \"c\") // Returns: \"abc\"\n * str.concat(\"test\") // Returns: \"test\"\n * ```\n */\nexport function concat(...strings: simple_string[]): string {\n return strings.join('');\n}\n\n/**\n * Formats a string with placeholders (PineScript `str.format`, Java MessageFormat syntax).\n *\n * @param formatStr - Pattern with `{0}`, `{1,number,#.##}`, `{0,number,percent}`, `{0,date,yyyy-MM-dd}`...\n * @param args - Values for the placeholders\n * @returns Formatted string\n *\n * @remarks\n * As in PineScript: numbers in `{n}` use\n * \"#,##0.###\" (1234.5678 gives \"1,234.568\"); number patterns round half to even on the exact\n * value (16 decimals at most from 1e-3 up); an array gives \"[a, b]\"; `'...'` is literal text and `''` a quote;\n * a missing argument leaves `{n}` in the text.\n * Dates are formatted in UTC here; PineScript uses the exchange time zone.\n *\n * @example\n * ```typescript\n * str.format('Close: {0,number,#.##}', 101.456) // \"Close: 101.46\"\n * str.format('{0} and {1}', 'a', 2) // \"a and 2\"\n * ```\n */\nexport function format(formatStr: simple_string, ...args: any[]): string {\n return formatMessage(formatStr, args, 'Etc/UTC');\n}\n\n/**\n * Checks if a string starts with a specific prefix.\n *\n * @param source - The string to check\n * @param str - The prefix to look for\n * @returns True if source starts with str, false otherwise\n *\n * @remarks\n * - Search is case-sensitive\n * - Empty string prefix always returns true\n *\n * @example\n * ```typescript\n * str.startswith(\"hello world\", \"hello\") // Returns: true\n * str.startswith(\"hello world\", \"Hello\") // Returns: false (case-sensitive)\n * str.startswith(\"test\", \"testing\") // Returns: false\n * ```\n */\nexport function startswith(source: simple_string, str: simple_string): bool {\n return source.startsWith(str);\n}\n\n/**\n * Checks if a string ends with a specific suffix.\n *\n * @param source - The string to check\n * @param str - The suffix to look for\n * @returns True if source ends with str, false otherwise\n *\n * @remarks\n * - Search is case-sensitive\n * - Empty string suffix always returns true\n *\n * @example\n * ```typescript\n * str.endswith(\"hello world\", \"world\") // Returns: true\n * str.endswith(\"hello world\", \"World\") // Returns: false (case-sensitive)\n * str.endswith(\"testing\", \"test\") // Returns: false\n * ```\n */\nexport function endswith(source: simple_string, str: simple_string): bool {\n return source.endsWith(str);\n}\n\n/**\n * Returns the character at a specific position in a string.\n *\n * @param str - The source string\n * @param pos - The 0-based position\n * @returns The character at the position, or empty string if out of bounds\n *\n * @remarks\n * - Returns empty string for negative or out-of-bounds positions\n * - Unicode characters may span multiple code units\n *\n * @example\n * ```typescript\n * str.charAt(\"hello\", 0) // Returns: \"h\"\n * str.charAt(\"hello\", 4) // Returns: \"o\"\n * str.charAt(\"hello\", 10) // Returns: \"\"\n * ```\n */\nexport function charAt(str: simple_string, pos: simple_int): string {\n return str.charAt(pos);\n}\n\n/**\n * Removes whitespace from both ends of a string.\n *\n * @param str - The string to trim\n * @returns The trimmed string\n *\n * @remarks\n * - Removes spaces, tabs, newlines, and other whitespace characters\n * - Preserves internal whitespace\n *\n * @example\n * ```typescript\n * str.trim(\" hello \") // Returns: \"hello\"\n * str.trim(\" hello world \") // Returns: \"hello world\"\n * str.trim(\"\\thello\\n\") // Returns: \"hello\"\n * ```\n */\nexport function trim(str: simple_string): string {\n return str.trim();\n}\n\n/**\n * Removes whitespace from the left (start) of a string.\n *\n * @param str - The string to trim\n * @returns The trimmed string\n *\n * @remarks\n * - Only removes leading whitespace\n * - Preserves trailing and internal whitespace\n *\n * @example\n * ```typescript\n * str.trimLeft(\" hello \") // Returns: \"hello \"\n * str.trimLeft(\" hello\") // Returns: \"hello\"\n * str.trimLeft(\"\\thello\") // Returns: \"hello\"\n * ```\n */\nexport function trimLeft(str: simple_string): string {\n return str.trimStart();\n}\n\n/**\n * Removes whitespace from the right (end) of a string.\n *\n * @param str - The string to trim\n * @returns The trimmed string\n *\n * @remarks\n * - Only removes trailing whitespace\n * - Preserves leading and internal whitespace\n *\n * @example\n * ```typescript\n * str.trimRight(\" hello \") // Returns: \" hello\"\n * str.trimRight(\"hello \") // Returns: \"hello\"\n * str.trimRight(\"hello\\t\") // Returns: \"hello\"\n * ```\n */\nexport function trimRight(str: simple_string): string {\n return str.trimEnd();\n}\n\n/**\n * Returns the first substring of `source` that matches the `regex` (PineScript `str.match`).\n *\n * @param source - Source string\n * @param regex - Regular expression\n * @returns The first match (searched anywhere in the string), or na (null) when nothing matches or the match is empty\n *\n * @remarks\n * - As PineScript: \"Hello World!\" with \"o\" gives \"o\", with \"[a-z]+\" gives \"ello\"; no match gives na\n * - Uses JavaScript regex syntax\n *\n * @example\n * ```typescript\n * str.match(\"abc123def\", \"[0-9]+\") // Returns: \"123\"\n * str.match(\"abc\", \"[0-9]+\") // Returns: null (na)\n * ```\n */\nexport function match(source: simple_string, regex: simple_string): simple_string | null {\n const found = new RegExp(regex).exec(source);\n return found && found[0] !== '' ? found[0] : null;\n}\n\n/**\n * Formats a timestamp as a string according to the specified format.\n *\n * @param time - Unix timestamp in milliseconds\n * @param format - Format string using PineScript format specifiers\n * @returns Formatted date/time string\n *\n * @remarks\n * Supported format specifiers (case-sensitive):\n * - `yyyy` - 4-digit year (e.g., \"2024\")\n * - `yy` - 2-digit year (e.g., \"24\")\n * - `MMMM` - Full month name (e.g., \"January\")\n * - `MMM` - Abbreviated month name (e.g., \"Jan\")\n * - `MM` - 2-digit month (01-12)\n * - `M` - Month (1-12)\n * - `dd` - 2-digit day (01-31)\n * - `d` - Day (1-31)\n * - `HH` - 2-digit hour (00-23)\n * - `H` - Hour (0-23)\n * - `hh` - 2-digit hour (01-12)\n * - `h` - Hour (1-12)\n * - `mm` - 2-digit minute (00-59)\n * - `m` - Minute (0-59)\n * - `ss` - 2-digit second (00-59)\n * - `s` - Second (0-59)\n * - `a` - AM/PM\n *\n * @example\n * ```typescript\n * const timestamp = 1609459200000; // Jan 1, 2021 00:00:00 UTC\n * str.format_time(timestamp, \"dd MMM yyyy\") // Returns: \"01 Jan 2021\"\n * str.format_time(timestamp, \"yyyy-MM-dd HH:mm:ss\") // Returns: \"2021-01-01 00:00:00\"\n * str.format_time(timestamp, \"MMM d, yyyy\") // Returns: \"Jan 1, 2021\"\n * str.format_time(timestamp, \"hh:mm a\") // Returns: \"12:00 AM\"\n * ```\n */\n/**\n * Constructs a new string containing the source string repeated N times with an optional separator.\n *\n * @param source - The string to repeat\n * @param count - Number of times to repeat\n * @param separator - String to inject between repeated instances. Optional, defaults to empty string.\n * @returns The repeated string, or null (na) if source is na or count is 0 / negative / na, as in PineScript\n *\n * @example\n * ```typescript\n * str.repeat(\"ab\", 3) // Returns: \"ababab\"\n * str.repeat(\"?\", 3, \",\") // Returns: \"?,?,?\"\n * str.repeat(\"hello\", 0) // Returns: null (na)\n * str.repeat(\"x\", 1) // Returns: \"x\"\n * ```\n */\nexport function repeat(source: simple_string, count: simple_int, separator: simple_string = ''): string | null {\n if (source == null) return null;\n if (!(count > 0)) return null; // 0, negative or na: na\n return Array(count).fill(source).join(separator);\n}\n\n/**\n * Formats a UNIX time (ms) with a date pattern (PineScript `str.format_time`).\n *\n * @param time - UNIX time in milliseconds\n * @param format - Java SimpleDateFormat pattern, e.g. \"yyyy-MM-dd HH:mm:ss\", \"dd MMM yyyy\", \"hh:mm a\"\n * @param timezone - UTC/GMT offset (\"UTC-5\") or IANA name (\"America/New_York\"). PineScript's default is\n * the exchange time zone, which is not known here: the default is UTC\n * @returns Formatted date string\n *\n * @remarks\n * Letters: y, M, d, E, u, D, w,\n * H, k, K, h, a, m, s, S, Z, z; 'text' is literal text.\n */\nexport function format_time(time: simple_int, format: simple_string = \"yyyy-MM-dd'T'HH:mm:ssZ\", timezone: simple_string = 'Etc/UTC'): string {\n return formatDate(time,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AAc,WAAW,MAAM,SAAS;AACjD;AAoBO,SAAS,WAAW,QAAuB,KAA0B;AAC1E,SAAO,OAAO,WAAW,GAAG;AAC9B;AAoBO,SAAS,SAAS,QAAuB,KAA0B;AACxE,SAAO,OAAO,SAAS,GAAG;AAC5B;AAoBO,SAAS,OAAO,KAAoBC,MAAyB;AAClE,SAAO,IAAI,OAAOA,IAAG;AACvB;AAmBO,SAAS,KAAK,KAA4B;AAC/C,SAAO,IAAI,KAAK;AAClB;AAmBO,SAAS,SAAS,KAA4B;AACnD,SAAO,IAAI,UAAU;AACvB;AAmBO,SAAS,UAAU,KAA4B;AACpD,SAAO,IAAI,QAAQ;AACrB;AAmBO,SAAS,MAAM,QAAuB,OAA4C;AACvF,QAAM,QAAQ,IAAI,OAAO,KAAK,EAAE,KAAK,MAAM;AAC3C,SAAO,SAAS,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI;AAC/C;AAsDO,SAAS,OAAO,QAAuB,OAAmB,YAA2B,IAAmB;AAC7G,MAAI,UAAU,KAAM,QAAO;AAC3B,MAAI,EAAE,QAAQ,GAAI,QAAO;AACzB,SAAO,MAAM,KAAK,EAAE,KAAK,MAAM,EAAE,KAAK,SAAS;AACjD;AAeO,SAAS,YAAY,MAAkBD,UAAwB,0BAA0B,WAA0B,WAAmB;AAC3I,aAAO,8BAAW,MAAMA,SAAQ,QAAQ;AAC1C;",
6
6
  "names": ["format", "pos"]
7
7
  }
@@ -6,10 +6,12 @@
6
6
  * PineScript rules:
7
7
  * - `str.tostring` with a format rounds half away from zero on the shortest decimal form of the number
8
8
  * (`1.005` with "#.##" gives "1.01", `2.5` with "#" gives "3")
9
- * - `str.tostring` without a format rounds the exact binary value to 10 decimals (12.34500000005 is
10
- * 12.34500000004999975...: "12.345", and "12.3450000001" with the format "#.##########")
9
+ * - `str.tostring` without a format rounds the digits of the JVM's binary to decimal conversion to 10 decimals,
10
+ * half to even, the conversion flags deciding a tie (see `floatingdecimal.ts`): 12.34500000005 gives "12.345"
11
+ * ("12.3450000001" with the format "#.##########"), 1791662400001 / 900000 gives "1990736.000001111"
11
12
  * - `str.format` rounds half to even on the exact binary value (`0.25` with "#.#" gives "0.2")
12
- * - a negative number that rounds to zero loses its sign; "#.00" writes `.50` (no leading zero),
13
+ * - a negative number that rounds to zero loses its sign, except with "%" ("#.#%": -0.0004 gives "-0%");
14
+ * "#.00" writes `.50` (no leading zero),
13
15
  * but "#.##" writes `0.5` (a pattern without any '0' shows one integer digit)
14
16
  * - with an exponent, the value is first rounded to the fraction digits ("0.00E0": 0.125 gives "1.30E-1")
15
17
  * - a pattern without digit characters (`format.price` is "price") formats like "#" after its text,
@@ -19,7 +21,7 @@
19
21
  * - at most 16 decimals when |x| >= 1e-3 (the shortest digits of a double never have more there):
20
22
  * 0.1 with 20 '#' decimals gives "0.1" in both rounding modes
21
23
  */
22
- export type Rounding = 'halfUpShortest' | 'halfUpExact' | 'halfEvenExact';
24
+ export type Rounding = 'halfUpShortest' | 'halfUpExact' | 'halfEvenExact' | 'halfEvenConverted';
23
25
  /** Formats a number with a DecimalFormat pattern. */
24
26
  export declare function formatNumber(value: number, pattern: string, mode: Rounding): string;
25
27
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"numberformat.d.ts","sourceRoot":"","sources":["../../../src/str/numberformat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,MAAM,QAAQ,GAAG,gBAAgB,GAAG,aAAa,GAAG,eAAe,CAAC;AA8K1E,qDAAqD;AACrD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,CA6BnF;AASD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAMhF"}
1
+ {"version":3,"file":"numberformat.d.ts","sourceRoot":"","sources":["../../../src/str/numberformat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,MAAM,MAAM,QAAQ,GAAG,gBAAgB,GAAG,aAAa,GAAG,eAAe,GAAG,mBAAmB,CAAC;AA8KhG,qDAAqD;AACrD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,CA8BnF;AASD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAMhF"}
@@ -22,6 +22,7 @@ __export(numberformat_exports, {
22
22
  tickScale: () => tickScale
23
23
  });
24
24
  module.exports = __toCommonJS(numberformat_exports);
25
+ var import_floatingdecimal = require("./floatingdecimal.js");
25
26
  const patterns = /* @__PURE__ */ new Map();
26
27
  function subpatternSplit(pattern) {
27
28
  let quoted = false;
@@ -179,11 +180,11 @@ function formatNumber(value, pattern, mode) {
179
180
  body = layout(mant, p) + "E" + (exponent < 0 ? "-" : "") + e;
180
181
  } else {
181
182
  const frac = !p.hasDigits ? 0 : Math.abs(x) >= 1e-3 ? Math.min(p.maxFrac, 16) : p.maxFrac;
182
- const rounded = roundDigits(toDigits(x), frac, mode);
183
+ const rounded = mode === "halfEvenConverted" ? (0, import_floatingdecimal.javaFixedDigits)(x, frac) : roundDigits(toDigits(x), frac, mode);
183
184
  isZero = rounded.digits === "";
184
185
  body = p.hasDigits ? layout(rounded, p) : layout(rounded, { ...p, minInt: 0, maxFrac: 0, minFrac: 0 });
185
186
  }
186
- return affixes(p, x < 0 && (!isZero || !p.hasDigits), body);
187
+ return affixes(p, x < 0 && (!isZero || !p.hasDigits || p.percent), body);
187
188
  }
188
189
  function affixes(p, negative, body) {
189
190
  if (!negative) return p.prefix + body + p.suffix;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/str/numberformat.ts"],
4
- "sourcesContent": ["/**\n * Number patterns (\"#.##\", \"#,##0.00\", \"0.00E0\", \"#.##%\", \"'#'#.##\") as PineScript formats them.\n *\n * The pattern syntax is Java's DecimalFormat: `0` required digit, `#` optional digit, `,` grouping,\n * `.` decimal point, `E0` exponent, `%` multiplies by 100, `'...'` quoted literal text.\n * PineScript rules:\n * - `str.tostring` with a format rounds half away from zero on the shortest decimal form of the number\n * (`1.005` with \"#.##\" gives \"1.01\", `2.5` with \"#\" gives \"3\")\n * - `str.tostring` without a format rounds the exact binary value to 10 decimals (12.34500000005 is\n * 12.34500000004999975...: \"12.345\", and \"12.3450000001\" with the format \"#.##########\")\n * - `str.format` rounds half to even on the exact binary value (`0.25` with \"#.#\" gives \"0.2\")\n * - a negative number that rounds to zero loses its sign; \"#.00\" writes `.50` (no leading zero),\n * but \"#.##\" writes `0.5` (a pattern without any '0' shows one integer digit)\n * - with an exponent, the value is first rounded to the fraction digits (\"0.00E0\": 0.125 gives \"1.30E-1\")\n * - a pattern without digit characters (`format.price` is \"price\") formats like \"#\" after its text,\n * and keeps the sign: -0.004 gives \"-price0\"\n * - \"pos;neg\": a negative number uses the text around the digits of the negative subpattern instead of \"-\"\n * (\"#.##;(#.##)\" gives \"(3.5)\" for -3.5); the digits follow the positive subpattern, as in Java\n * - at most 16 decimals when |x| >= 1e-3 (the shortest digits of a double never have more there):\n * 0.1 with 20 '#' decimals gives \"0.1\" in both rounding modes\n */\n\nexport type Rounding = 'halfUpShortest' | 'halfUpExact' | 'halfEvenExact';\n\ninterface Pattern {\n prefix: string;\n suffix: string;\n /** Text around the digits of the negative subpattern (\"pos;neg\"), or null without one */\n negPrefix: string | null;\n negSuffix: string | null;\n minInt: number;\n minFrac: number;\n maxFrac: number;\n /** Digits per group, 0 without grouping */\n grouping: number;\n percent: boolean;\n /** Minimum exponent digits, or null without exponent */\n exponent: number | null;\n hasDigits: boolean;\n}\n\nconst patterns = new Map<string, Pattern>();\n\n/** Index of the first ';' outside quotes, or -1. */\nfunction subpatternSplit(pattern: string): number {\n let quoted = false;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === \"'\") quoted = !quoted;\n else if (pattern[i] === ';' && !quoted) return i;\n }\n return -1;\n}\n\nfunction parsePattern(pattern: string): Pattern {\n const cached = patterns.get(pattern);\n if (cached) return cached;\n const semi = subpatternSplit(pattern);\n if (semi !== -1) {\n // only the text around the digits of the negative subpattern is used\n const neg = parsePattern(pattern.slice(semi + 1));\n const parsed = { ...parsePattern(pattern.slice(0, semi)), negPrefix: neg.prefix, negSuffix: neg.suffix };\n patterns.set(pattern, parsed);\n return parsed;\n }\n\n let prefix = '';\n let suffix = '';\n let number = '';\n let percent = false;\n let phase: 'prefix' | 'number' | 'suffix' = 'prefix';\n for (let i = 0; i < pattern.length; i++) {\n const ch = pattern[i]!;\n let literal: string;\n if (ch === \"'\") {\n const end = pattern.indexOf(\"'\", i + 1);\n if (end === i + 1) {\n literal = \"'\";\n i = end;\n } else {\n literal = pattern.slice(i + 1, end === -1 ? undefined : end);\n i = end === -1 ? pattern.length : end;\n }\n } else if (phase !== 'suffix' && ('#0,.'.includes(ch) || (phase === 'number' && ch === 'E'))) {\n phase = 'number';\n number += ch;\n continue;\n } else {\n if (ch === '%') percent = true;\n literal = ch;\n }\n if (phase === 'number') phase = 'suffix';\n if (phase === 'prefix') prefix += literal;\n else suffix += literal;\n }\n\n const [mantissa = '', exp] = number.split('E');\n const [intPart = '', fracPart = ''] = mantissa.split('.');\n const lastComma = intPart.lastIndexOf(',');\n const parsed: Pattern = {\n prefix,\n suffix,\n negPrefix: null,\n negSuffix: null,\n // as in Java, a pattern with a decimal point and no '0' at all (\"#.##\") shows one integer digit\n minInt: !mantissa.includes('0') && mantissa.includes('.') ? 1 : [...intPart].filter((c) => c === '0').length,\n minFrac: [...fracPart].filter((c) => c === '0').length,\n maxFrac: [...fracPart].filter((c) => c === '0' || c === '#').length,\n grouping: lastComma === -1 ? 0 : intPart.length - lastComma - 1,\n percent,\n exponent: exp === undefined ? null : exp.length,\n hasDigits: /[0#]/.test(mantissa),\n };\n patterns.set(pattern, parsed);\n return parsed;\n}\n\n/** Decimal digits of |x|: value = 0.d1d2d3... \u00D7 10^intLen (no leading zero digit; \"\" for 0). */\ninterface Digits {\n digits: string;\n intLen: number;\n}\n\nfunction shortestDigits(x: number): Digits {\n const m = /^(\\d+)(?:\\.(\\d+))?(?:e([+-]\\d+))?$/.exec(String(Math.abs(x)))!;\n const all = m[1]! + (m[2] ?? '');\n let intLen = m[1]!.length + Number(m[3] ?? 0);\n const lead = all.length - all.replace(/^0+/, '').length;\n intLen -= lead;\n const digits = all.slice(lead).replace(/0+$/, '');\n return { digits, intLen: digits ? intLen : 0 };\n}\n\n/** Exact decimal expansion of the double |x|. */\nfunction exactDigits(x: number): Digits {\n const abs = Math.abs(x);\n if (abs === 0) return { digits: '', intLen: 0 };\n const view = new DataView(new ArrayBuffer(8));\n view.setFloat64(0, abs);\n const bits = view.getBigUint64(0);\n const expBits = Number((bits >> 52n) & 0x7ffn);\n let mant = bits & 0xfffffffffffffn;\n const e2 = expBits === 0 ? -1074 : expBits - 1075;\n if (expBits !== 0) mant |= 1n << 52n;\n let str: string;\n let fracDigits: number;\n if (e2 >= 0) {\n str = (mant << BigInt(e2)).toString();\n fracDigits = 0;\n } else {\n str = (mant * 5n ** BigInt(-e2)).toString();\n fracDigits = -e2;\n }\n const intLen = str.length - fracDigits;\n const lead = str.length - str.replace(/^0+/, '').length;\n const digits = str.slice(lead).replace(/0+$/, '');\n return { digits, intLen: intLen - lead };\n}\n\n/** Rounds to `frac` digits after the point. */\nfunction roundDigits(d: Digits, frac: number, mode: Rounding): Digits {\n const keep = d.intLen + frac;\n if (keep >= d.digits.length) return d;\n if (keep < 0) return { digits: '', intLen: 0 };\n const first = d.digits.charCodeAt(keep) - 48;\n let up: boolean;\n if (mode !== 'halfEvenExact') up = first >= 5;\n else if (first !== 5) up = first > 5;\n else if (d.digits.length > keep + 1) up = true;\n else up = keep > 0 && (d.digits.charCodeAt(keep - 1) - 48) % 2 === 1;\n let kept = d.digits.slice(0, keep);\n let intLen = d.intLen;\n if (up) {\n const n = (BigInt(kept || '0') + 1n).toString();\n if (n.length > kept.length) intLen += 1;\n kept = n;\n }\n kept = kept.replace(/0+$/, '');\n return { digits: kept, intLen: kept ? intLen : 0 };\n}\n\nfunction group(int: string, size: number): string {\n if (!size || int.length <= size) return int;\n const parts: string[] = [];\n for (let end = int.length; end > 0; end -= size) parts.unshift(int.slice(Math.max(0, end - size), end));\n return parts.join(',');\n}\n\nfunction layout(d: Digits, p: Pattern): string {\n let int = d.intLen > 0 ? d.digits.slice(0, d.intLen).padEnd(d.intLen, '0') : '';\n int = int.replace(/^0+/, '').padStart(p.minInt, '0');\n let frac = d.intLen < 0 ? '0'.repeat(-d.intLen) + d.digits : d.digits.slice(Math.max(0, d.intLen));\n frac = frac.slice(0, p.maxFrac).replace(/0+$/, '').padEnd(p.minFrac, '0');\n if (!int && !frac) int = '0';\n return group(int, p.grouping) + (frac ? '.' + frac : '');\n}\n\n/** Formats a number with a DecimalFormat pattern. */\nexport function formatNumber(value: number, pattern: string, mode: Rounding): string {\n if (Number.isNaN(value)) return 'NaN';\n const p = parsePattern(pattern);\n if (!Number.isFinite(value)) return affixes(p, value < 0, '\u221E');\n const x = p.percent ? value * 100 : value;\n const toDigits = mode === 'halfUpShortest' ? shortestDigits : exactDigits;\n\n let body: string;\n let isZero: boolean;\n if (p.exponent !== null) {\n const rounded = roundDigits(toDigits(x), p.maxFrac, mode);\n const intDigits = Math.max(p.minInt, 1);\n isZero = rounded.digits === '';\n let exponent = isZero ? 0 : rounded.intLen - intDigits;\n let mant = roundDigits({ digits: rounded.digits, intLen: isZero ? 0 : intDigits }, p.maxFrac, mode);\n if (mant.intLen > intDigits) {\n exponent += 1;\n mant = { digits: mant.digits, intLen: intDigits };\n }\n const e = String(Math.abs(exponent)).padStart(p.exponent, '0');\n body = layout(mant, p) + 'E' + (exponent < 0 ? '-' : '') + e;\n } else {\n // 16 decimals at most from 1e-3 up (the shortest digits of a double have no more there)\n const frac = !p.hasDigits ? 0 : Math.abs(x) >= 1e-3 ? Math.min(p.maxFrac, 16) : p.maxFrac;\n const rounded = roundDigits(toDigits(x), frac, mode);\n isZero = rounded.digits === '';\n body = p.hasDigits ? layout(rounded, p) : layout(rounded, { ...p, minInt: 0, maxFrac: 0, minFrac: 0 });\n }\n return affixes(p, x < 0 && (!isZero || !p.hasDigits), body);\n}\n\n/** `body` with the text of the positive pattern, or of the negative one (\"-\" + prefix without \"pos;neg\"). */\nfunction affixes(p: Pattern, negative: boolean, body: string): string {\n if (!negative) return p.prefix + body + p.suffix;\n if (p.negPrefix === null) return '-' + p.prefix + body + p.suffix;\n return p.negPrefix + body + p.negSuffix!;\n}\n\n/**\n * `[minmove, pricescale]` of a tick (PineScript `syminfo.mintick = syminfo.minmove / syminfo.pricescale`).\n * Without `pricescale` it is 10^(decimals of the tick): 0.02 is 2 / 100, 0.25 is 25 / 100. A symbol priced in\n * fractions needs its own (1/32 is 1 / 32).\n */\nexport function tickScale(mintick: number, pricescale?: number): [number, number] {\n if (pricescale === undefined) {\n const m = /^\\d+(?:\\.(\\d+))?(?:e-(\\d+))?$/.exec(String(mintick));\n pricescale = Number(`1e${m ? (m[1]?.length ?? 0) + Number(m[2] ?? 0) : 0}`);\n }\n return [Math.round(mintick * pricescale), pricescale];\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyCA,MAAM,WAAW,oBAAI,IAAqB;AAG1C,SAAS,gBAAgB,SAAyB;AAChD,MAAI,SAAS;AACb,WAAS,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;AACvC,QAAI,QAAQ,CAAC,MAAM,IAAK,UAAS,CAAC;AAAA,aACzB,QAAQ,CAAC,MAAM,OAAO,CAAC,OAAQ,QAAO;AAAA,EACjD;AACA,SAAO;AAC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S,UAAU,SAAiB,YAAuC;AAChF,MAAI,eAAe,QAAW;AAC5B,UAAM,IAAI,gCAAgC,KAAK,OAAO,OAAO,CAAC;AAC9D,iBAAa,OAAO,KAAK,KAAK,EAAE,CAAC,GAAG,UAAU,KAAK,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;AAAA,EAC5E;AACA,SAAO,CAAC,KAAK,MAAM,UAAU,UAAU,GAAG,UAAU;AACtD;",
4
+ "sourcesContent": ["/**\n * Number patterns (\"#.##\", \"#,##0.00\", \"0.00E0\", \"#.##%\", \"'#'#.##\") as PineScript formats them.\n *\n * The pattern syntax is Java's DecimalFormat: `0` required digit, `#` optional digit, `,` grouping,\n * `.` decimal point, `E0` exponent, `%` multiplies by 100, `'...'` quoted literal text.\n * PineScript rules:\n * - `str.tostring` with a format rounds half away from zero on the shortest decimal form of the number\n * (`1.005` with \"#.##\" gives \"1.01\", `2.5` with \"#\" gives \"3\")\n * - `str.tostring` without a format rounds the digits of the JVM's binary to decimal conversion to 10 decimals,\n * half to even, the conversion flags deciding a tie (see `floatingdecimal.ts`): 12.34500000005 gives \"12.345\"\n * (\"12.3450000001\" with the format \"#.##########\"), 1791662400001 / 900000 gives \"1990736.000001111\"\n * - `str.format` rounds half to even on the exact binary value (`0.25` with \"#.#\" gives \"0.2\")\n * - a negative number that rounds to zero loses its sign, except with \"%\" (\"#.#%\": -0.0004 gives \"-0%\");\n * \"#.00\" writes `.50` (no leading zero),\n * but \"#.##\" writes `0.5` (a pattern without any '0' shows one integer digit)\n * - with an exponent, the value is first rounded to the fraction digits (\"0.00E0\": 0.125 gives \"1.30E-1\")\n * - a pattern without digit characters (`format.price` is \"price\") formats like \"#\" after its text,\n * and keeps the sign: -0.004 gives \"-price0\"\n * - \"pos;neg\": a negative number uses the text around the digits of the negative subpattern instead of \"-\"\n * (\"#.##;(#.##)\" gives \"(3.5)\" for -3.5); the digits follow the positive subpattern, as in Java\n * - at most 16 decimals when |x| >= 1e-3 (the shortest digits of a double never have more there):\n * 0.1 with 20 '#' decimals gives \"0.1\" in both rounding modes\n */\n\nimport { javaFixedDigits } from './floatingdecimal.js';\n\nexport type Rounding = 'halfUpShortest' | 'halfUpExact' | 'halfEvenExact' | 'halfEvenConverted';\n\ninterface Pattern {\n prefix: string;\n suffix: string;\n /** Text around the digits of the negative subpattern (\"pos;neg\"), or null without one */\n negPrefix: string | null;\n negSuffix: string | null;\n minInt: number;\n minFrac: number;\n maxFrac: number;\n /** Digits per group, 0 without grouping */\n grouping: number;\n percent: boolean;\n /** Minimum exponent digits, or null without exponent */\n exponent: number | null;\n hasDigits: boolean;\n}\n\nconst patterns = new Map<string, Pattern>();\n\n/** Index of the first ';' outside quotes, or -1. */\nfunction subpatternSplit(pattern: string): number {\n let quoted = false;\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === \"'\") quoted = !quoted;\n else if (pattern[i] === ';' && !quoted) return i;\n }\n return -1;\n}\n\nfunction parsePattern(pattern: string): Pattern {\n const cached = patterns.get(pattern);\n if (cached) return cached;\n const semi = subpatternSplit(pattern);\n if (semi !== -1) {\n // only the text around the digits of the negative subpattern is used\n const neg = parsePattern(pattern.slice(semi + 1));\n const parsed = { ...parsePattern(pattern.slice(0, semi)), negPrefix: neg.prefix, negSuffix: neg.suffix };\n patterns.set(pattern, parsed);\n return parsed;\n }\n\n let prefix = '';\n let suffix = '';\n let number = '';\n let percent = false;\n let phase: 'prefix' | 'number' | 'suffix' = 'prefix';\n for (let i = 0; i < pattern.length; i++) {\n const ch = pattern[i]!;\n let literal: string;\n if (ch === \"'\") {\n const end = pattern.indexOf(\"'\", i + 1);\n if (end === i + 1) {\n literal = \"'\";\n i = end;\n } else {\n literal = pattern.slice(i + 1, end === -1 ? undefined : end);\n i = end === -1 ? pattern.length : end;\n }\n } else if (phase !== 'suffix' && ('#0,.'.includes(ch) || (phase === 'number' && ch === 'E'))) {\n phase = 'number';\n number += ch;\n continue;\n } else {\n if (ch === '%') percent = true;\n literal = ch;\n }\n if (phase === 'number') phase = 'suffix';\n if (phase === 'prefix') prefix += literal;\n else suffix += literal;\n }\n\n const [mantissa = '', exp] = number.split('E');\n const [intPart = '', fracPart = ''] = mantissa.split('.');\n const lastComma = intPart.lastIndexOf(',');\n const parsed: Pattern = {\n prefix,\n suffix,\n negPrefix: null,\n negSuffix: null,\n // as in Java, a pattern with a decimal point and no '0' at all (\"#.##\") shows one integer digit\n minInt: !mantissa.includes('0') && mantissa.includes('.') ? 1 : [...intPart].filter((c) => c === '0').length,\n minFrac: [...fracPart].filter((c) => c === '0').length,\n maxFrac: [...fracPart].filter((c) => c === '0' || c === '#').length,\n grouping: lastComma === -1 ? 0 : intPart.length - lastComma - 1,\n percent,\n exponent: exp === undefined ? null : exp.length,\n hasDigits: /[0#]/.test(mantissa),\n };\n patterns.set(pattern, parsed);\n return parsed;\n}\n\n/** Decimal digits of |x|: value = 0.d1d2d3... \u00D7 10^intLen (no leading zero digit; \"\" for 0). */\ninterface Digits {\n digits: string;\n intLen: number;\n}\n\nfunction shortestDigits(x: number): Digits {\n const m = /^(\\d+)(?:\\.(\\d+))?(?:e([+-]\\d+))?$/.exec(String(Math.abs(x)))!;\n const all = m[1]! + (m[2] ?? '');\n let intLen = m[1]!.length + Number(m[3] ?? 0);\n const lead = all.length - all.replace(/^0+/, '').length;\n intLen -= lead;\n const digits = all.slice(lead).replace(/0+$/, '');\n return { digits, intLen: digits ? intLen : 0 };\n}\n\n/** Exact decimal expansion of the double |x|. */\nfunction exactDigits(x: number): Digits {\n const abs = Math.abs(x);\n if (abs === 0) return { digits: '', intLen: 0 };\n const view = new DataView(new ArrayBuffer(8));\n view.setFloat64(0, abs);\n const bits = view.getBigUint64(0);\n const expBits = Number((bits >> 52n) & 0x7ffn);\n let mant = bits & 0xfffffffffffffn;\n const e2 = expBits === 0 ? -1074 : expBits - 1075;\n if (expBits !== 0) mant |= 1n << 52n;\n let str: string;\n let fracDigits: number;\n if (e2 >= 0) {\n str = (mant << BigInt(e2)).toString();\n fracDigits = 0;\n } else {\n str = (mant * 5n ** BigInt(-e2)).toString();\n fracDigits = -e2;\n }\n const intLen = str.length - fracDigits;\n const lead = str.length - str.replace(/^0+/, '').length;\n const digits = str.slice(lead).replace(/0+$/, '');\n return { digits, intLen: intLen - lead };\n}\n\n/** Rounds to `frac` digits after the point. */\nfunction roundDigits(d: Digits, frac: number, mode: Rounding): Digits {\n const keep = d.intLen + frac;\n if (keep >= d.digits.length) return d;\n if (keep < 0) return { digits: '', intLen: 0 };\n const first = d.digits.charCodeAt(keep) - 48;\n let up: boolean;\n if (mode !== 'halfEvenExact') up = first >= 5;\n else if (first !== 5) up = first > 5;\n else if (d.digits.length > keep + 1) up = true;\n else up = keep > 0 && (d.digits.charCodeAt(keep - 1) - 48) % 2 === 1;\n let kept = d.digits.slice(0, keep);\n let intLen = d.intLen;\n if (up) {\n const n = (BigInt(kept || '0') + 1n).toString();\n if (n.length > kept.length) intLen += 1;\n kept = n;\n }\n kept = kept.replace(/0+$/, '');\n return { digits: kept, intLen: kept ? intLen : 0 };\n}\n\nfunction group(int: string, size: number): string {\n if (!size || int.length <= size) return int;\n const parts: string[] = [];\n for (let end = int.length; end > 0; end -= size) parts.unshift(int.slice(Math.max(0, end - size), end));\n return parts.join(',');\n}\n\nfunction layout(d: Digits, p: Pattern): string {\n let int = d.intLen > 0 ? d.digits.slice(0, d.intLen).padEnd(d.intLen, '0') : '';\n int = int.replace(/^0+/, '').padStart(p.minInt, '0');\n let frac = d.intLen < 0 ? '0'.repeat(-d.intLen) + d.digits : d.digits.slice(Math.max(0, d.intLen));\n frac = frac.slice(0, p.maxFrac).replace(/0+$/, '').padEnd(p.minFrac, '0');\n if (!int && !frac) int = '0';\n return group(int, p.grouping) + (frac ? '.' + frac : '');\n}\n\n/** Formats a number with a DecimalFormat pattern. */\nexport function formatNumber(value: number, pattern: string, mode: Rounding): string {\n if (Number.isNaN(value)) return 'NaN';\n const p = parsePattern(pattern);\n if (!Number.isFinite(value)) return affixes(p, value < 0, '\u221E');\n const x = p.percent ? value * 100 : value;\n const toDigits = mode === 'halfUpShortest' ? shortestDigits : exactDigits;\n\n let body: string;\n let isZero: boolean;\n if (p.exponent !== null) {\n const rounded = roundDigits(toDigits(x), p.maxFrac, mode);\n const intDigits = Math.max(p.minInt, 1);\n isZero = rounded.digits === '';\n let exponent = isZero ? 0 : rounded.intLen - intDigits;\n let mant = roundDigits({ digits: rounded.digits, intLen: isZero ? 0 : intDigits }, p.maxFrac, mode);\n if (mant.intLen > intDigits) {\n exponent += 1;\n mant = { digits: mant.digits, intLen: intDigits };\n }\n const e = String(Math.abs(exponent)).padStart(p.exponent, '0');\n body = layout(mant, p) + 'E' + (exponent < 0 ? '-' : '') + e;\n } else {\n // 16 decimals at most from 1e-3 up (the shortest digits of a double have no more there)\n const frac = !p.hasDigits ? 0 : Math.abs(x) >= 1e-3 ? Math.min(p.maxFrac, 16) : p.maxFrac;\n const rounded = mode === 'halfEvenConverted' ? javaFixedDigits(x, frac) : roundDigits(toDigits(x), frac, mode);\n isZero = rounded.digits === '';\n body = p.hasDigits ? layout(rounded, p) : layout(rounded, { ...p, minInt: 0, maxFrac: 0, minFrac: 0 });\n }\n // a negative number that rounds to zero keeps its sign with a percent pattern (\"-0%\", #180)\n return affixes(p, x < 0 && (!isZero || !p.hasDigits || p.percent), body);\n}\n\n/** `body` with the text of the positive pattern, or of the negative one (\"-\" + prefix without \"pos;neg\"). */\nfunction affixes(p: Pattern, negative: boolean, body: string): string {\n if (!negative) return p.prefix + body + p.suffix;\n if (p.negPrefix === null) return '-' + p.prefix + body + p.suffix;\n return p.negPrefix + body + p.negSuffix!;\n}\n\n/**\n * `[minmove, pricescale]` of a tick (PineScript `syminfo.mintick = syminfo.minmove / syminfo.pricescale`).\n * Without `pricescale` it is 10^(decimals of the tick): 0.02 is 2 / 100, 0.25 is 25 / 100. A symbol priced in\n * fractions needs its own (1/32 is 1 / 32).\n */\nexport function tickScale(mintick: number, pricescale?: number): [number, number] {\n if (pricescale === undefined) {\n const m = /^\\d+(?:\\.(\\d+))?(?:e-(\\d+))?$/.exec(String(mintick));\n pricescale = Number(`1e${m ? (m[1]?.length ?? 0) + Number(m[2] ?? 0) : 0}`);\n }\n return [Math.round(mintick * pricescale), pricescale];\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBA,6BAAgC;AAqBhC,MAAM,WAAW,oBAAI,IAAqB;AAG1C,SAAS,gBAAgB,SAAyB;AAChD,MAAI,SAAS;AACb,WAAS,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;AACvC,QAAI,QAAQ,CAAC,MAAM,IAAK,UAAS,CAAC;AAAA,aACzB,QAAQ,CAAC,MAAM,OAAO,CAAC,OAAQ,QAAO;AAAA,EACjD;AACA,SAAO;AACT;AAEA,SAAS,aAAa,SAA0B;AAC9C,QAAM,SAAS,SAAS,IAAI,OAAO;AACnC,MAAI,OAAQ,QAAO;AACnB,QAAM,OAAO,gBAAgB,OAAO;AACpC,MAAI,SAAS,IAAI;AAEf,UAAM,MAAM,aAAa,QAAQ,MAAM,OAAO,CAAC,CAAC;AAChD,UAAMA,UAAS,EAAE,GAAG,aAAa,QAAQ,MAAM,GAAG,IAAI,CAAC,GAAG,WAAW,IAAI,QAAQ,WAAW,IAAI,OAAO;AACvG,aAAS,IAAI,SAASA,OAAM;AAC5B,WAAOA;AAAA,EACT;AAEA,MAAI,SAAS;AACb,MAAI,SAAS;AACb,MAAI,SAAS;AACb,MAAI,UAAU;AACd,MAAI,QAAwC;AAC5C,WAAS,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;AACvC,UAAM,KAAK,QAAQ,CAAC;AACpB,QAAI;AACJ,QAAI,OAAO,KAAK;AACd,YAAM,MAAM,QAAQ,QAAQ,KAAK,IAAI,CAAC;AACtC,UAAI,QAAQ,IAAI,GAAG;AACjB,kBAAU;AACV,YAAI;AAAA,MACN,OAAO;AACL,kBAAU,QA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,IAAI,EAAE;AAClF,UAAM,UAAU,SAAS,0BAAsB,wCAAgB,GAAG,IAAI,IAAI,YAAY,SAAS,CAAC,GAAG,MAAM,IAAI;AAC7G,aAAS,QAAQ,WAAW;AAC5B,WAAO,EAAE,YAAY,OAAO,SAAS,CAAC,IAAI,OAAO,SAAS,EAAE,GAAG,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,EAAE,CAAC;AAAA,EACvG;AAEA,SAAO,QAAQ,GAAG,IAAI,MAAM,CAAC,UAAU,CAAC,EAAE,aAAa,EAAE,UAAU,IAAI;AACzE;AAGA,SAAS,QAAQ,GAAY,UAAmB,MAAsB;AACpE,MAAI,CAAC,SAAU,QAAO,EAAE,SAAS,OAAO,EAAE;AAC1C,MAAI,EAAE,cAAc,KAAM,QAAO,MAAM,EAAE,SAAS,OAAO,EAAE;AAC3D,SAAO,EAAE,YAAY,OAAO,EAAE;AAChC;AAOO,SAAS,UAAU,SAAiB,YAAuC;AAChF,MAAI,eAAe,QAAW;AAC5B,UAAM,IAAI,gCAAgC,KAAK,OAAO,OAAO,CAAC;AAC9D,iBAAa,OAAO,KAAK,KAAK,EAAE,CAAC,GAAG,UAAU,KAAK,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;AAAA,EAC5E;AACA,SAAO,CAAC,KAAK,MAAM,UAAU,UAAU,GAAG,UAAU;AACtD;",
6
6
  "names": ["parsed"]
7
7
  }
@@ -79,6 +79,12 @@ export declare function ema(source: Source, length: simple_int): series_float;
79
79
  * ```
80
80
  */
81
81
  export declare function rsi(source: Source, length: simple_int): series_float;
82
+ /**
83
+ * PineScript v4 `rsi(x, y)` with two series (#180): `x` and `y` are the averages of the upward and downward changes,
84
+ * already computed. As in PineScript: 100 when `y` is within 1e-10 of zero (also with an na `x`), else 0 when `x` is,
85
+ * else `100 - 100 / (1 + x / y)`, na when that divides by zero (`x == -y`). Versions 5 and 6 have the length form only.
86
+ */
87
+ export declare function rsi(x: Source, y: Source): series_float;
82
88
  /**
83
89
  * Moving Average Convergence Divergence - trend-following momentum indicator showing relationship
84
90
  * between two moving averages.
@@ -682,8 +688,8 @@ export declare function correlation(source1: Source, source2: Source, length: si
682
688
  *
683
689
  * PineScript rules:
684
690
  * - percentrank = count(source[k] <= source, k = 1..length) * 100 / length (in this order: the PineScript bits)
685
- * - a value from bar `length` on, when the current source is not `na`; an `na` value in the window counts as not
686
- * `<=` the current value
691
+ * - a value from bar `length` on; an `na` value in the window counts as not `<=` the current value, and an `na`
692
+ * current value gives 0 (#177)
687
693
  * - the comparison uses the 1e-10 tolerance
688
694
  *
689
695
  * @example
@@ -1313,31 +1319,42 @@ export declare function percentile_nearest_rank(source: Source, length: simple_i
1313
1319
  */
1314
1320
  export declare function rci(source: Source, length: simple_int): series_float;
1315
1321
  /**
1316
- * Pivot Point Levels
1322
+ * Pivot Point Levels (PineScript `ta.pivot_point_levels`).
1317
1323
  *
1318
- * Calculates pivot point levels using various calculation methods.
1319
- * Returns an array containing: [P, R1, S1, R2, S2, R3, S3, R4, S4, R5, S5]
1324
+ * Returns 11 series: [P, R1, S1, R2, S2, R3, S3, R4, S4, R5, S5] (one value per bar in each).
1320
1325
  *
1321
1326
  * @param type - Calculation type: "Traditional", "Fibonacci", "Woodie", "Classic", "DM", "Camarilla"
1322
- * @param anchor - Condition that triggers reset of calculations
1323
- * @param developing - If true, pivots recalculate continuously; if false, use last anchor values
1324
- * @param high - High price series (optional, uses context if not provided)
1325
- * @param low - Low price series (optional, uses context if not provided)
1326
- * @param close - Close price series (optional, uses context if not provided)
1327
- * @param open - Open price series (optional, uses context if not provided)
1328
- * @returns Array of 11 pivot levels
1327
+ * @param anchor - Condition that starts a new period (`timeframe.change("W")`...)
1328
+ * @param developing - false: the levels of the previous period, constant until the next anchor; true: the levels of
1329
+ * the current period so far, recalculated on each bar
1330
+ * @param high - High price series
1331
+ * @param low - Low price series
1332
+ * @param close - Close price series
1333
+ * @param open - Open price series (Woodie and DM)
1334
+ * @returns 11 series of levels
1329
1335
  *
1330
1336
  * @example
1331
1337
  * ```typescript
1332
1338
  * const weekChange = [false, false, false, false, true, false, ...]; // Weekly anchor
1333
- * const pivots = ta.pivot_point_levels("Traditional", weekChange, false, high, low, close);
1334
- * // pivots[i]! = [P, R1, S1, R2, S2, R3, S3, R4, S4, R5, S5]
1339
+ * const levels = ta.pivot_point_levels("Traditional", weekChange, false, high, low, close, open);
1340
+ * // levels[0]![i] is P on bar i, levels[5]![i] is R3
1335
1341
  * ```
1336
1342
  *
1337
1343
  * @remarks
1338
- * - Woodie type cannot use developing=true (will error in PineScript)
1339
- * - DM type only calculates P, R1, S1 (other levels are NaN)
1340
- * - All calculations follow PineScript v6 specifications
1344
+ * As in PineScript (#177):
1345
+ * - a period runs from an anchor bar to the bar before the next anchor; the bars before the first anchor are a
1346
+ * period too (from bar 0). The fixed levels use the high and low of the previous period and the close of the bar
1347
+ * before the anchor (na with an anchor on bar 0), and are na until the first anchor; the developing levels use
1348
+ * the current period's high and low and the bar's close, from bar 0
1349
+ * - Traditional: R3 = P * 2 + (H - 2 * L), S3 = P * 2 - (2 * H - L), R4 = P * 3 + (H - 3 * L), S4 = P * 3 - (3 * H - L),
1350
+ * R5 = P * 4 + (H - 4 * L), S5 = P * 4 - (4 * H - L)
1351
+ * - Fibonacci: P +- 0.382 / 0.618 / 1 * (H - L); R4 to S5 na
1352
+ * - Classic: R3 / S3 = P +- 2 * (H - L), R4 / S4 = P +- 3 * (H - L); R5 / S5 na
1353
+ * - Woodie: P = (H + L + 2 * open of the current period) / 4, R3 = H + 2 * (P - L), S3 = L - 2 * (H - P), R4 / S4 =
1354
+ * R3 + (H - L) / S3 - (H - L); R5 / S5 na. `developing` true throws (RE10128)
1355
+ * - DM: x = H + 2 * L + C (C < open of the period), 2 * H + L + C (C > O) or H + L + 2 * C; P = x / 4,
1356
+ * R1 = x / 2 - L, S1 = x / 2 - H; the other levels na
1357
+ * - Camarilla: C +- (H - L) * 1.1 / 12, / 6, / 4, / 2 for R1 to S4, R5 = (H / L) * C, S5 = 2 * C - R5
1341
1358
  */
1342
1359
  export declare function pivot_point_levels(type: series_float | string, anchor: series_bool, developing?: series_bool | boolean, high?: Source, low?: Source, close?: Source, open?: Source): series_float[];
1343
1360
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ta/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAO,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKnI;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,YAAY,CASxF;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,YAAY,CAuCpE;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,YAAY,CA+BpE;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,IAAI,CAClB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,UAAU,GACvB,CAAC,YAAY,EAAE,YAAY,EAAE,YAAY,CAAC,CAiB5C;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,EAAE,CAChB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,YAAY,GACjB,CAAC,YAAY,EAAE,YAAY,EAAE,YAAY,CAAC,CAc5C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,KAAK,CACnB,MA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