This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fetch("/foo.json").then(resp => { | |
return resp.json(); | |
}).then(json => { | |
return processJson(json); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// foo.js | |
'lang sweet.js'; | |
export syntax m = // ... | |
// main.js | |
'lang sweet.js'; | |
import { m } from './foo'; | |
m // ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// log.js | |
'lang sweet.js'; | |
export function log(msg) { | |
console.log(msg); | |
} | |
// main.js | |
import { log } from './log.js' for syntax; | |
syntax m = ctx => { | |
log('doing some Sweet things'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as H from 'sweet.js/helpers' for syntax; | |
syntax m = ctx => { | |
let v = ctx.next().value; | |
if (H.isIdentifier(v, 'foo') { | |
return H.fromString(v, 'bar'); | |
} | |
return H.fromString(v, 'baz'); | |
} | |
m foo; // expands to 'bar' |
OlderNewer