about summary refs log tree commit diff stats
path: root/src/js/jsutils.nim
blob: b8a8398e34b6f6e418e2bea257f7981eaa8a0734 (plain) (blame)
1
2
3
4
5
6
7
8
9
import bindings/quickjs

template toJSValueArray*(a: openArray[JSValue]): ptr UncheckedArray[JSValue] =
  cast[ptr UncheckedArray[JSValue]](unsafeAddr a[0])

# Warning: this must be a template, because we're taking the address of
# the passed value, and Nim is pass-by-value.
template toJSValueArray*(a: JSValue): ptr UncheckedArray[JSValue] =
  cast[ptr UncheckedArray[JSValue]](unsafeAddr a)