@oliversalzburg/js-utils 0.0.4 → 0.0.6

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 (112) hide show
  1. package/coverage/base.css +224 -0
  2. package/coverage/block-navigation.js +87 -0
  3. package/coverage/bundle.js +30 -0
  4. package/coverage/favicon.png +0 -0
  5. package/coverage/index.html +16 -0
  6. package/coverage/prettify.css +1 -0
  7. package/coverage/prettify.js +2 -0
  8. package/coverage/sort-arrow-sprite.png +0 -0
  9. package/coverage/sorter.js +196 -0
  10. package/coverage/spa.css +298 -0
  11. package/coverage/string-formatter.ts.html +187 -0
  12. package/coverage/tmp/coverage-4186-1699218521999-0.json +1 -0
  13. package/coverage/tmp/coverage-4196-1699218521967-0.json +1 -0
  14. package/docs/README.md +3 -0
  15. package/docs/classes/AbstractError.md +271 -0
  16. package/docs/classes/Canvas.md +177 -0
  17. package/docs/classes/InternalError.md +301 -0
  18. package/docs/classes/InvalidArgumentError.md +277 -0
  19. package/docs/classes/InvalidOperationError.md +277 -0
  20. package/docs/classes/NotImplementedError.md +276 -0
  21. package/docs/classes/PermissionViolationError.md +277 -0
  22. package/docs/classes/Random.md +109 -0
  23. package/docs/classes/RenderLoop.md +49 -0
  24. package/docs/classes/ResourceConflictError.md +276 -0
  25. package/docs/classes/UnexpectedNilError.md +169 -0
  26. package/docs/classes/UnknownError.md +280 -0
  27. package/docs/classes/Vector2.md +79 -0
  28. package/docs/classes/Vector3.md +106 -0
  29. package/docs/modules.md +1313 -0
  30. package/lib/core.d.ts +21 -0
  31. package/lib/core.js +3 -0
  32. package/{output → lib}/core.js.map +1 -1
  33. package/{output → lib}/error-serializer.d.ts +1 -1
  34. package/{output → lib}/error-serializer.js +1 -1
  35. package/{output → lib}/errors/AbstractError.d.ts +9 -1
  36. package/{output → lib}/errors/AbstractError.js +10 -2
  37. package/{output → lib}/errors/AbstractError.js.map +1 -1
  38. package/{output → lib}/errors/InternalError.d.ts +6 -1
  39. package/{output → lib}/errors/InternalError.js +6 -1
  40. package/lib/errors/InternalError.js.map +1 -0
  41. package/{output → lib}/errors/InvalidArgumentError.d.ts +1 -1
  42. package/{output → lib}/errors/InvalidArgumentError.js +1 -1
  43. package/{output → lib}/errors/InvalidOperationError.d.ts +1 -1
  44. package/{output → lib}/errors/InvalidOperationError.js +1 -1
  45. package/{output → lib}/errors/NotImplementedError.d.ts +1 -1
  46. package/{output → lib}/errors/NotImplementedError.js +1 -1
  47. package/{output → lib}/errors/PermissionViolationError.d.ts +1 -1
  48. package/{output → lib}/errors/PermissionViolationError.js +1 -1
  49. package/{output → lib}/errors/ResourceConflictError.d.ts +1 -1
  50. package/{output → lib}/errors/ResourceConflictError.js +1 -1
  51. package/{output → lib}/errors/UnknownError.d.ts +2 -2
  52. package/{output → lib}/errors/UnknownError.js +2 -2
  53. package/lib/graphics/canvas.d.ts +80 -0
  54. package/lib/graphics/canvas.js +164 -0
  55. package/lib/graphics/canvas.js.map +1 -0
  56. package/lib/graphics/core.d.ts +94 -0
  57. package/lib/graphics/core.js +479 -0
  58. package/lib/graphics/core.js.map +1 -0
  59. package/lib/graphics/index.d.ts +3 -0
  60. package/lib/graphics/index.js +4 -0
  61. package/lib/graphics/index.js.map +1 -0
  62. package/lib/graphics/render-loop.d.ts +20 -0
  63. package/lib/graphics/render-loop.js +51 -0
  64. package/lib/graphics/render-loop.js.map +1 -0
  65. package/{output → lib}/index.d.ts +4 -0
  66. package/{output → lib}/index.js +4 -0
  67. package/lib/index.js.map +1 -0
  68. package/lib/math/core.d.ts +46 -0
  69. package/lib/math/core.js +72 -0
  70. package/lib/math/core.js.map +1 -0
  71. package/lib/math/index.d.ts +2 -0
  72. package/lib/math/index.js +3 -0
  73. package/lib/math/index.js.map +1 -0
  74. package/lib/math/vector.d.ts +33 -0
  75. package/lib/math/vector.js +42 -0
  76. package/lib/math/vector.js.map +1 -0
  77. package/{output → lib}/nil.d.ts +13 -8
  78. package/{output → lib}/nil.js +16 -11
  79. package/lib/nil.js.map +1 -0
  80. package/lib/random.d.ts +56 -0
  81. package/lib/random.js +184 -0
  82. package/lib/random.js.map +1 -0
  83. package/lib/string-formatter.test.d.ts +1 -0
  84. package/lib/string-formatter.test.js +17 -0
  85. package/lib/string-formatter.test.js.map +1 -0
  86. package/mkdocs.yml +52 -0
  87. package/package.json +25 -13
  88. package/typedoc.json +8 -0
  89. package/output/core.d.ts +0 -4
  90. package/output/core.js +0 -2
  91. package/output/errors/InternalError.js.map +0 -1
  92. package/output/index.js.map +0 -1
  93. package/output/nil.js.map +0 -1
  94. /package/{output → lib}/array.d.ts +0 -0
  95. /package/{output → lib}/array.js +0 -0
  96. /package/{output → lib}/array.js.map +0 -0
  97. /package/{output → lib}/error-serializer.js.map +0 -0
  98. /package/{output → lib}/errors/InvalidArgumentError.js.map +0 -0
  99. /package/{output → lib}/errors/InvalidOperationError.js.map +0 -0
  100. /package/{output → lib}/errors/NotImplementedError.js.map +0 -0
  101. /package/{output → lib}/errors/PermissionViolationError.js.map +0 -0
  102. /package/{output → lib}/errors/ResourceConflictError.js.map +0 -0
  103. /package/{output → lib}/errors/UnknownError.js.map +0 -0
  104. /package/{output → lib}/errors/index.d.ts +0 -0
  105. /package/{output → lib}/errors/index.js +0 -0
  106. /package/{output → lib}/errors/index.js.map +0 -0
  107. /package/{output → lib}/sleep.d.ts +0 -0
  108. /package/{output → lib}/sleep.js +0 -0
  109. /package/{output → lib}/sleep.js.map +0 -0
  110. /package/{output → lib}/string-formatter.d.ts +0 -0
  111. /package/{output → lib}/string-formatter.js +0 -0
  112. /package/{output → lib}/string-formatter.js.map +0 -0
@@ -0,0 +1,196 @@
1
+ /* eslint-disable */
2
+ var addSorting = (function() {
3
+ 'use strict';
4
+ var cols,
5
+ currentSort = {
6
+ index: 0,
7
+ desc: false
8
+ };
9
+
10
+ // returns the summary table element
11
+ function getTable() {
12
+ return document.querySelector('.coverage-summary');
13
+ }
14
+ // returns the thead element of the summary table
15
+ function getTableHeader() {
16
+ return getTable().querySelector('thead tr');
17
+ }
18
+ // returns the tbody element of the summary table
19
+ function getTableBody() {
20
+ return getTable().querySelector('tbody');
21
+ }
22
+ // returns the th element for nth column
23
+ function getNthColumn(n) {
24
+ return getTableHeader().querySelectorAll('th')[n];
25
+ }
26
+
27
+ function onFilterInput() {
28
+ const searchValue = document.getElementById('fileSearch').value;
29
+ const rows = document.getElementsByTagName('tbody')[0].children;
30
+ for (let i = 0; i < rows.length; i++) {
31
+ const row = rows[i];
32
+ if (
33
+ row.textContent
34
+ .toLowerCase()
35
+ .includes(searchValue.toLowerCase())
36
+ ) {
37
+ row.style.display = '';
38
+ } else {
39
+ row.style.display = 'none';
40
+ }
41
+ }
42
+ }
43
+
44
+ // loads the search box
45
+ function addSearchBox() {
46
+ var template = document.getElementById('filterTemplate');
47
+ var templateClone = template.content.cloneNode(true);
48
+ templateClone.getElementById('fileSearch').oninput = onFilterInput;
49
+ template.parentElement.appendChild(templateClone);
50
+ }
51
+
52
+ // loads all columns
53
+ function loadColumns() {
54
+ var colNodes = getTableHeader().querySelectorAll('th'),
55
+ colNode,
56
+ cols = [],
57
+ col,
58
+ i;
59
+
60
+ for (i = 0; i < colNodes.length; i += 1) {
61
+ colNode = colNodes[i];
62
+ col = {
63
+ key: colNode.getAttribute('data-col'),
64
+ sortable: !colNode.getAttribute('data-nosort'),
65
+ type: colNode.getAttribute('data-type') || 'string'
66
+ };
67
+ cols.push(col);
68
+ if (col.sortable) {
69
+ col.defaultDescSort = col.type === 'number';
70
+ colNode.innerHTML =
71
+ colNode.innerHTML + '<span class="sorter"></span>';
72
+ }
73
+ }
74
+ return cols;
75
+ }
76
+ // attaches a data attribute to every tr element with an object
77
+ // of data values keyed by column name
78
+ function loadRowData(tableRow) {
79
+ var tableCols = tableRow.querySelectorAll('td'),
80
+ colNode,
81
+ col,
82
+ data = {},
83
+ i,
84
+ val;
85
+ for (i = 0; i < tableCols.length; i += 1) {
86
+ colNode = tableCols[i];
87
+ col = cols[i];
88
+ val = colNode.getAttribute('data-value');
89
+ if (col.type === 'number') {
90
+ val = Number(val);
91
+ }
92
+ data[col.key] = val;
93
+ }
94
+ return data;
95
+ }
96
+ // loads all row data
97
+ function loadData() {
98
+ var rows = getTableBody().querySelectorAll('tr'),
99
+ i;
100
+
101
+ for (i = 0; i < rows.length; i += 1) {
102
+ rows[i].data = loadRowData(rows[i]);
103
+ }
104
+ }
105
+ // sorts the table using the data for the ith column
106
+ function sortByIndex(index, desc) {
107
+ var key = cols[index].key,
108
+ sorter = function(a, b) {
109
+ a = a.data[key];
110
+ b = b.data[key];
111
+ return a < b ? -1 : a > b ? 1 : 0;
112
+ },
113
+ finalSorter = sorter,
114
+ tableBody = document.querySelector('.coverage-summary tbody'),
115
+ rowNodes = tableBody.querySelectorAll('tr'),
116
+ rows = [],
117
+ i;
118
+
119
+ if (desc) {
120
+ finalSorter = function(a, b) {
121
+ return -1 * sorter(a, b);
122
+ };
123
+ }
124
+
125
+ for (i = 0; i < rowNodes.length; i += 1) {
126
+ rows.push(rowNodes[i]);
127
+ tableBody.removeChild(rowNodes[i]);
128
+ }
129
+
130
+ rows.sort(finalSorter);
131
+
132
+ for (i = 0; i < rows.length; i += 1) {
133
+ tableBody.appendChild(rows[i]);
134
+ }
135
+ }
136
+ // removes sort indicators for current column being sorted
137
+ function removeSortIndicators() {
138
+ var col = getNthColumn(currentSort.index),
139
+ cls = col.className;
140
+
141
+ cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, '');
142
+ col.className = cls;
143
+ }
144
+ // adds sort indicators for current column being sorted
145
+ function addSortIndicators() {
146
+ getNthColumn(currentSort.index).className += currentSort.desc
147
+ ? ' sorted-desc'
148
+ : ' sorted';
149
+ }
150
+ // adds event listeners for all sorter widgets
151
+ function enableUI() {
152
+ var i,
153
+ el,
154
+ ithSorter = function ithSorter(i) {
155
+ var col = cols[i];
156
+
157
+ return function() {
158
+ var desc = col.defaultDescSort;
159
+
160
+ if (currentSort.index === i) {
161
+ desc = !currentSort.desc;
162
+ }
163
+ sortByIndex(i, desc);
164
+ removeSortIndicators();
165
+ currentSort.index = i;
166
+ currentSort.desc = desc;
167
+ addSortIndicators();
168
+ };
169
+ };
170
+ for (i = 0; i < cols.length; i += 1) {
171
+ if (cols[i].sortable) {
172
+ // add the click event handler on the th so users
173
+ // dont have to click on those tiny arrows
174
+ el = getNthColumn(i).querySelector('.sorter').parentElement;
175
+ if (el.addEventListener) {
176
+ el.addEventListener('click', ithSorter(i));
177
+ } else {
178
+ el.attachEvent('onclick', ithSorter(i));
179
+ }
180
+ }
181
+ }
182
+ }
183
+ // adds sorting functionality to the UI
184
+ return function() {
185
+ if (!getTable()) {
186
+ return;
187
+ }
188
+ cols = loadColumns();
189
+ loadData();
190
+ addSearchBox();
191
+ addSortIndicators();
192
+ enableUI();
193
+ };
194
+ })();
195
+
196
+ window.addEventListener('load', addSorting);
@@ -0,0 +1,298 @@
1
+ /* Base */
2
+
3
+ body,
4
+ html {
5
+ margin: 0;
6
+ padding: 0;
7
+ height: 100%;
8
+ }
9
+
10
+ body {
11
+ color: #333;
12
+ background-color: #fcfcfc;
13
+ font: 14px/14px -apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI',
14
+ Roboto, 'Helvetica Neue', Arial, sans-serif;
15
+ }
16
+
17
+ button {
18
+ margin: 0;
19
+ border: none;
20
+ font: inherit;
21
+ color: inherit;
22
+ }
23
+
24
+ button:focus {
25
+ outline: none;
26
+ }
27
+
28
+ *,
29
+ *:after,
30
+ *:before {
31
+ -webkit-box-sizing: border-box;
32
+ -moz-box-sizing: border-box;
33
+ box-sizing: border-box;
34
+ }
35
+
36
+ /* Typography */
37
+
38
+ h1 {
39
+ font-size: 20px;
40
+ line-height: 20px;
41
+ margin: 0;
42
+ }
43
+
44
+ a {
45
+ color: #0074d9;
46
+ text-decoration: none;
47
+ }
48
+
49
+ a:hover {
50
+ text-decoration: underline;
51
+ }
52
+
53
+ .small {
54
+ font-size: 12px;
55
+ }
56
+
57
+ .strong {
58
+ font-weight: bold;
59
+ }
60
+
61
+ .center {
62
+ text-align: center;
63
+ }
64
+
65
+ .quiet {
66
+ opacity: 0.7;
67
+ }
68
+
69
+ /* Colors */
70
+
71
+ .low {
72
+ background: #fce1e5;
73
+ }
74
+
75
+ .low--dark {
76
+ background: #c21f39;
77
+ }
78
+
79
+ .medium {
80
+ background: #fff4c2;
81
+ }
82
+
83
+ .medium--dark {
84
+ background: #f9cd0b;
85
+ }
86
+
87
+ .high {
88
+ background: rgb(230, 245, 208);
89
+ }
90
+
91
+ .high--dark {
92
+ background: rgb(77, 146, 33);
93
+ }
94
+
95
+ /* App */
96
+
97
+ .app {
98
+ height: 100%;
99
+ }
100
+
101
+ /* Layout */
102
+
103
+ .layout {
104
+ display: flex;
105
+ flex-direction: column;
106
+ min-height: 100%;
107
+ padding: 20px;
108
+ }
109
+
110
+ .layout__section {
111
+ flex-grow: 0;
112
+ }
113
+
114
+ .layout__section--fill {
115
+ flex-grow: 1;
116
+ }
117
+
118
+ .layout__section + .layout__section {
119
+ margin-top: 20px;
120
+ }
121
+
122
+ @media only screen and (max-width: 640px) {
123
+ .col3 {
124
+ width: 100%;
125
+ max-width: 100%;
126
+ }
127
+ .hide-mobile {
128
+ display: none !important;
129
+ }
130
+ }
131
+
132
+ /* Toolbar */
133
+
134
+ .toolbar {
135
+ display: flex;
136
+ flex-wrap: wrap;
137
+ }
138
+
139
+ .toolbar__item {
140
+ margin-right: 40px;
141
+ margin-bottom: 10px;
142
+ }
143
+
144
+ /* Toggle */
145
+
146
+ .toggle {
147
+ display: inline-flex;
148
+ align-items: center;
149
+ }
150
+
151
+ .toggle__label {
152
+ margin-right: 0.5em;
153
+ }
154
+
155
+ .toggle__options {
156
+ display: inline-block;
157
+ border: 1px solid #0074d9;
158
+ border-radius: 4px;
159
+ color: #0074d9;
160
+ overflow: hidden;
161
+ white-space: nowrap;
162
+ }
163
+
164
+ .toggle__option {
165
+ padding: 4px 8px;
166
+ background: #fcfcfc;
167
+ }
168
+
169
+ .toggle__option + .toggle__option {
170
+ border-left: 1px solid #0074d9;
171
+ }
172
+
173
+ .toggle__option.is-toggled {
174
+ color: #fff;
175
+ background: #0074d9;
176
+ border-left-color: #fcfcfc;
177
+ }
178
+
179
+ /* Expand */
180
+
181
+ .expandbutton {
182
+ display: inline-block;
183
+ width: 1em;
184
+ margin-right: 0.25em;
185
+ padding: 0;
186
+ background-color: transparent;
187
+ font-weight: bold;
188
+ }
189
+
190
+ /* Fraction */
191
+
192
+ .fraction {
193
+ font-size: 12px;
194
+ color: #666;
195
+ padding: 2px 4px;
196
+ border-radius: 4px;
197
+ }
198
+
199
+ /* Coverage */
200
+
201
+ .coverage-summary {
202
+ border-collapse: collapse;
203
+ }
204
+
205
+ .coverage-summary tbody tr {
206
+ border-bottom: 1px solid #fff;
207
+ }
208
+
209
+ .coverage-summary td,
210
+ .coverage-summary th {
211
+ padding: 5px;
212
+ }
213
+
214
+ .coverage-summary th {
215
+ text-align: center;
216
+ font-weight: normal;
217
+ white-space: nowrap;
218
+ }
219
+
220
+ .coverage-summary th.abs,
221
+ .coverage-summary td.pct,
222
+ .coverage-summary td.abs {
223
+ text-align: right;
224
+ }
225
+
226
+ .coverage-summary th.file {
227
+ min-width: 300px;
228
+ text-align: left;
229
+ }
230
+
231
+ .coverage-summary td.file {
232
+ white-space: nowrap;
233
+ }
234
+
235
+ .coverage-summary td.pct {
236
+ font-weight: 400;
237
+ }
238
+
239
+ .coverage-summary td.abs {
240
+ color: #666;
241
+ font-size: 12px;
242
+ }
243
+
244
+ .coverage-summary td.empty {
245
+ opacity: 0.5;
246
+ }
247
+
248
+ .coverage-summary .headercell {
249
+ border-top: 1px solid #eee;
250
+ text-align: right;
251
+ font-size: 12px;
252
+ color: #666;
253
+ }
254
+
255
+ .coverage-summary .headercell:nth-child(5n - 2),
256
+ .coverage-summary td:nth-child(5n - 2) {
257
+ border-left: 2px solid #fcfcfc;
258
+ padding-left: 2em;
259
+ }
260
+
261
+ .filetab {
262
+ display: inline-block;
263
+ width: 1em;
264
+ }
265
+
266
+ /* Sorter */
267
+
268
+ .sorter {
269
+ display: inline-block;
270
+ width: 7px;
271
+ height: 10px;
272
+ margin-left: 0.5em;
273
+ background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent;
274
+ }
275
+
276
+ .sorted .sorter {
277
+ background-position: 0 -20px;
278
+ }
279
+
280
+ .sorted-desc .sorter {
281
+ background-position: 0 -10px;
282
+ }
283
+
284
+ .sortable {
285
+ cursor: pointer;
286
+ }
287
+
288
+ /* Bar */
289
+
290
+ .bar {
291
+ width: 50px;
292
+ height: 5px;
293
+ background: #fff;
294
+ }
295
+
296
+ .bar__data {
297
+ height: 100%;
298
+ }
@@ -0,0 +1,187 @@
1
+
2
+ <!doctype html>
3
+ <html lang="en">
4
+
5
+ <head>
6
+ <title>Code coverage report for string-formatter.ts</title>
7
+ <meta charset="utf-8" />
8
+ <link rel="stylesheet" href="prettify.css" />
9
+ <link rel="stylesheet" href="base.css" />
10
+ <link rel="shortcut icon" type="image/x-icon" href="favicon.png" />
11
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
12
+ <style type='text/css'>
13
+ .coverage-summary .sorter {
14
+ background-image: url(sort-arrow-sprite.png);
15
+ }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <div class='wrapper'>
21
+ <div class='pad1'>
22
+ <h1><a href="javascript:history.back()">Back</a></h1>
23
+ <div class='clearfix'>
24
+
25
+ <div class='fl pad1y space-right2'>
26
+ <span class="strong">100% </span>
27
+ <span class="quiet">Statements</span>
28
+ <span class='fraction'>34/34</span>
29
+ </div>
30
+
31
+
32
+ <div class='fl pad1y space-right2'>
33
+ <span class="strong">100% </span>
34
+ <span class="quiet">Branches</span>
35
+ <span class='fraction'>7/7</span>
36
+ </div>
37
+
38
+
39
+ <div class='fl pad1y space-right2'>
40
+ <span class="strong">100% </span>
41
+ <span class="quiet">Functions</span>
42
+ <span class='fraction'>2/2</span>
43
+ </div>
44
+
45
+
46
+ <div class='fl pad1y space-right2'>
47
+ <span class="strong">100% </span>
48
+ <span class="quiet">Lines</span>
49
+ <span class='fraction'>34/34</span>
50
+ </div>
51
+
52
+
53
+ </div>
54
+ <p class="quiet">
55
+ Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
56
+ </p>
57
+ <template id="filterTemplate">
58
+ <div class="quiet">
59
+ Filter:
60
+ <input oninput="onInput()" type="search" id="fileSearch">
61
+ </div>
62
+ </template>
63
+ </div>
64
+ <div class='status-line high'></div>
65
+ <pre><table class="coverage">
66
+ <tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
67
+ <a name='L2'></a><a href='#L2'>2</a>
68
+ <a name='L3'></a><a href='#L3'>3</a>
69
+ <a name='L4'></a><a href='#L4'>4</a>
70
+ <a name='L5'></a><a href='#L5'>5</a>
71
+ <a name='L6'></a><a href='#L6'>6</a>
72
+ <a name='L7'></a><a href='#L7'>7</a>
73
+ <a name='L8'></a><a href='#L8'>8</a>
74
+ <a name='L9'></a><a href='#L9'>9</a>
75
+ <a name='L10'></a><a href='#L10'>10</a>
76
+ <a name='L11'></a><a href='#L11'>11</a>
77
+ <a name='L12'></a><a href='#L12'>12</a>
78
+ <a name='L13'></a><a href='#L13'>13</a>
79
+ <a name='L14'></a><a href='#L14'>14</a>
80
+ <a name='L15'></a><a href='#L15'>15</a>
81
+ <a name='L16'></a><a href='#L16'>16</a>
82
+ <a name='L17'></a><a href='#L17'>17</a>
83
+ <a name='L18'></a><a href='#L18'>18</a>
84
+ <a name='L19'></a><a href='#L19'>19</a>
85
+ <a name='L20'></a><a href='#L20'>20</a>
86
+ <a name='L21'></a><a href='#L21'>21</a>
87
+ <a name='L22'></a><a href='#L22'>22</a>
88
+ <a name='L23'></a><a href='#L23'>23</a>
89
+ <a name='L24'></a><a href='#L24'>24</a>
90
+ <a name='L25'></a><a href='#L25'>25</a>
91
+ <a name='L26'></a><a href='#L26'>26</a>
92
+ <a name='L27'></a><a href='#L27'>27</a>
93
+ <a name='L28'></a><a href='#L28'>28</a>
94
+ <a name='L29'></a><a href='#L29'>29</a>
95
+ <a name='L30'></a><a href='#L30'>30</a>
96
+ <a name='L31'></a><a href='#L31'>31</a>
97
+ <a name='L32'></a><a href='#L32'>32</a>
98
+ <a name='L33'></a><a href='#L33'>33</a>
99
+ <a name='L34'></a><a href='#L34'>34</a>
100
+ <a name='L35'></a><a href='#L35'>35</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
101
+ <span class="cline-any cline-yes">1x</span>
102
+ <span class="cline-any cline-yes">1x</span>
103
+ <span class="cline-any cline-yes">1x</span>
104
+ <span class="cline-any cline-yes">1x</span>
105
+ <span class="cline-any cline-yes">1x</span>
106
+ <span class="cline-any cline-yes">1x</span>
107
+ <span class="cline-any cline-yes">1x</span>
108
+ <span class="cline-any cline-yes">1x</span>
109
+ <span class="cline-any cline-yes">1x</span>
110
+ <span class="cline-any cline-yes">4x</span>
111
+ <span class="cline-any cline-yes">4x</span>
112
+ <span class="cline-any cline-yes">4x</span>
113
+ <span class="cline-any cline-yes">4x</span>
114
+ <span class="cline-any cline-yes">1x</span>
115
+ <span class="cline-any cline-yes">1x</span>
116
+ <span class="cline-any cline-yes">1x</span>
117
+ <span class="cline-any cline-yes">1x</span>
118
+ <span class="cline-any cline-yes">1x</span>
119
+ <span class="cline-any cline-yes">1x</span>
120
+ <span class="cline-any cline-yes">1x</span>
121
+ <span class="cline-any cline-yes">1x</span>
122
+ <span class="cline-any cline-yes">1x</span>
123
+ <span class="cline-any cline-yes">1x</span>
124
+ <span class="cline-any cline-yes">1x</span>
125
+ <span class="cline-any cline-yes">3x</span>
126
+ <span class="cline-any cline-yes">3x</span>
127
+ <span class="cline-any cline-yes">3x</span>
128
+ <span class="cline-any cline-yes">3x</span>
129
+ <span class="cline-any cline-yes">3x</span>
130
+ <span class="cline-any cline-yes">3x</span>
131
+ <span class="cline-any cline-yes">3x</span>
132
+ <span class="cline-any cline-yes">3x</span>
133
+ <span class="cline-any cline-yes">3x</span>
134
+ <span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">/**
135
+ * Formats a given input string with numeric placeholders.
136
+ * @example
137
+ * // returns "Hello World"
138
+ * formatString("{0} {1}", ["Hello", "World"]);
139
+ * @param string The input string with placeholders.
140
+ * @param formatArguments An array of strings to place into the placeholders.
141
+ * @returns The formatted string.
142
+ */
143
+ export const formatString = (string: string, ...formatArguments: Array&lt;string&gt;): string =&gt; {
144
+ return string.replace(/{(\d+)}/g, (match, matchedDigits: number): string =&gt;
145
+ typeof formatArguments[matchedDigits] !== "undefined" ? formatArguments[matchedDigits] : match,
146
+ );
147
+ };
148
+ &nbsp;
149
+ /**
150
+ * Formats a given input string with alphanumeric placeholders.
151
+ * @example
152
+ * // returns "Hello World"
153
+ * formatString("{first} {second}", {first:"Hello", second:"World"});
154
+ * @param string The input string with placeholders.
155
+ * @param parameters A hash of parameters to place in the placeholders.
156
+ * @returns The formatted string.
157
+ */
158
+ export const formatStringTemplate = (
159
+ string: string,
160
+ parameters: Record&lt;string, string | undefined&gt;,
161
+ ): string =&gt; {
162
+ string = string.replace(
163
+ /#{[\w.]+}/g,
164
+ query =&gt; parameters[query.slice(2, query.length - 1)] ?? "&lt;missing parameter&gt;",
165
+ );
166
+ return string;
167
+ };
168
+ &nbsp;</pre></td></tr></table></pre>
169
+
170
+ <div class='push'></div><!-- for sticky footer -->
171
+ </div><!-- /wrapper -->
172
+ <div class='footer quiet pad2 space-top1 center small'>
173
+ Code coverage generated by
174
+ <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
175
+ at 2023-11-05T21:08:42.276Z
176
+ </div>
177
+ <script src="prettify.js"></script>
178
+ <script>
179
+ window.onload = function () {
180
+ prettyPrint();
181
+ };
182
+ </script>
183
+ <script src="sorter.js"></script>
184
+ <script src="block-navigation.js"></script>
185
+ </body>
186
+ </html>
187
+