(target, context)
| 513 | * @returns {TargetProperties} target properties |
| 514 | */ |
| 515 | const getTargetProperties = (target, context) => { |
| 516 | for (const [, , regExp, handler] of TARGETS) { |
| 517 | const match = regExp.exec(target); |
| 518 | if (match) { |
| 519 | const [, ...args] = match; |
| 520 | const result = handler(...args, context); |
| 521 | if (result) return /** @type {TargetProperties} */ (result); |
| 522 | } |
| 523 | } |
| 524 | throw new Error( |
| 525 | `Unknown target '${target}'. The following targets are supported:\n${TARGETS.map( |
| 526 | ([name, description]) => `* ${name}: ${description}` |
| 527 | ).join("\n")}` |
| 528 | ); |
| 529 | }; |
| 530 | |
| 531 | /** |
| 532 | * Merges target properties. |
no test coverage detected