Skip to content

Instantly share code, notes, and snippets.

@kinsteronline
Created August 13, 2019 21:28
Show Gist options
  • Save kinsteronline/e2fc49d685fa3136a6804b18ac3d9a6e to your computer and use it in GitHub Desktop.
Save kinsteronline/e2fc49d685fa3136a6804b18ac3d9a6e to your computer and use it in GitHub Desktop.
Checking out QuickJS
/*
* qjsc -fno-eval -m -o ohai ohai.js
*/
"use strict";
"use math";
import * as std from "std"
import * as os from "os"
// dl'd from gh for local use
import { Decimal } from "./decimal.mjs"
function ohyeah (something = "OH YEAH!") {
return new Promise((resolve, reject) => {
resolve(something)
})
}
(async function () {
console.log('1 ::-----')
console.log('args: ', Array.from(scriptArgs).slice(1))
console.log('2 ::-----')
console.log(std.getenv('PWD'))
console.log('3 ::-----')
std.out.puts(await ohyeah("*crashes through wall* OH YEAH!"))
std.out.puts('\n')
console.log('4 ::-----')
console.log('platform: ', os.platform)
console.log('5 ::----- 🤡')
console.log('0.3 - 0.1 = ', (0.3 - 0.1))
console.log('0.3 - 0.1 = ', Decimal.sub('0.3', '0.1'))
console.log('X ::-----')
std.exit(0)
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment