(value, allowEmpty)
| 266 | * @returns {Replacer} replacer |
| 267 | */ |
| 268 | const replacer = (value, allowEmpty) => { |
| 269 | /** @type {Replacer} */ |
| 270 | const fn = (match, arg, input) => { |
| 271 | if (typeof value === "function") { |
| 272 | value = value(); |
| 273 | } |
| 274 | if (value === null || value === undefined) { |
| 275 | if (!allowEmpty) { |
| 276 | throw new Error( |
| 277 | `Path variable ${match} not implemented in this context: ${input}` |
| 278 | ); |
| 279 | } |
| 280 | |
| 281 | return ""; |
| 282 | } |
| 283 | |
| 284 | return `${value}`; |
| 285 | }; |
| 286 | |
| 287 | return fn; |
| 288 | }; |
| 289 | |
| 290 | /** @type {Map<string, (...args: EXPECTED_ANY[]) => EXPECTED_ANY>} */ |
| 291 | const deprecationCache = new Map(); |
no outgoing calls
no test coverage detected