yieldparser
yieldparser copied to clipboard
Add composite`/album/${albumID}/song/${songID}`
trafficstars
- Tagged template string
composite() - Takes any number of elements: regex, constant string, array of strings, or generator function.
- Transforms into generator function. Requires no changes to parser.
Example:
function* AlbumID() {…}
const songIDRegex = /^\d+/;
function* GetSong() {
const [albumID, [songID]] = yield composite`/album/${AlbumID}/song/${songIDRegex}`;
}