kristianmandrup / nim_esmodules

Nim ES modules support via macros

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ES2015 class support for Nim language

Provides a Nim class macro that allows creation of proper ES2015 classes (aka Javascript class support).

Usage

from es_class import class

class Rectangle:
  height: int
  width: int
  constructor:
    this.height = height
    this.width = width
  proc getArea(): int =
    return this.height * this.width

let
  expected = 25
  actual = newRectangle(5, 5).getArea()

Sweet :)

About

Nim ES modules support via macros


Languages

Language:Nim 73.1%Language:JavaScript 20.4%Language:HTML 6.5%