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 jsffi, macros | |
var console {.importc, nodecl.}: JsObject | |
var module {.importc, nodecl.}: JsObject | |
proc Array(size: cint = 0): JsObject {.importc} | |
proc push(arr, obj: JsObject) {.importc, nodecl.} | |
type Person = ref object | |
name: string | |
age: int |
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 options, typetraits, sugar, typeinfo | |
template `?`(T: typedesc): typedesc = | |
Option[T] | |
type | |
Bar = ref object | |
baz: int |
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
const { spawn } = require("child_process"); | |
const fs = require("fs"); | |
const { Asset } = require("parcel-bundler"); | |
function nimCompile (path) { | |
return new Promise((resolve, reject) => { | |
const compile = spawn("nim", ["js", path]) | |
let out = ""; | |
let err = ""; |
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 sugar, typetraits | |
type | |
Reducer[T, C] = proc (it: T, coll: C): C {. closure .} | |
Transducer[T1, C1, T2, C2] = proc (reducer: Reducer[T1, C1]): Reducer[T2, C2] {. closure .} | |
proc conj[T](it: T, s: seq[T]): seq[T] = | |
result.deepCopy(s) | |
result.add(it) |
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 norm/sqlite, norm/model | |
type Foo* = ref object of Model | |
str*: string | |
val*: int | |
type Bar* = ref object of Model | |
foo1*: Foo | |
foo2*: Foo |