conditional-tag
Version:
Clean, easily readable conditional statements in template literals/strings for Node.js and browsers. Provides `if` / `elseif` / `else` and `switch` / `case` / `default` syntax options.
21 lines (17 loc) • 496 B
HTML
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script type="module">
localStorage.debug = 'condtag:*';
import { _ } from './conditional-tag.debug.js';
async function test() {
return 'TEEEST';
}
console.log(await _.async`Das ist ein Test ${_.if(true)}IFFF${() => test()}${_.if(true)}.true as well.${_.endif}${_.else}EEELSE${_.endif}`);
</script>
</head>
<body>
</body>
</html>