src/nodejs/jstableutils

  • Getter for Table and OrderedTable, takes a variable and a block of code.

Example:

import src/nodejs/jstableutils
import std/tables

var tabla: Table[string, int]
tabla["example"] = 42
tabla["another"] = 9

tabla.get "example" as value:
  echo value
  doAssert value == 42

tabla.get "THIS_KEY_DOES_NOT_EXIST" as value:
  doAssert false, "WONT RUN"
  echo "Faster and simpler Table use without Option[T]"

Macros

macro get[A, B](self: var Table[A, B] | var OrderedTable[A, B];
                key, body: untyped)