Skip to content

Instantly share code, notes, and snippets.

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
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)
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 = "";
import options, typetraits, sugar, typeinfo
template `?`(T: typedesc): typedesc =
Option[T]
type
Bar = ref object
baz: int
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