diff --git a/examples/demo/match.js b/examples/demo/match.js new file mode 100644 index 0000000..fef8e70 --- /dev/null +++ b/examples/demo/match.js @@ -0,0 +1,11 @@ +const msg = Ant.match(process.argv[2], { + 200: 'ok', + 404: 'not found', + [$ >= 500 && $ < 600]: 'server error', + [Symbol.default]: code => { + console.log('unexpected code'); + return `unknown value ${code}`; + } +}); + +console.log(msg);