eslisp-propertify

0.3.0 • Public • Published

eslisp-propertify

An eslisp macro that rewrites its input forms' atoms that contain dots into property accesses. This means you can write x.y.1 instead of (. x y 1), which compiles to JS as x.y[1];.

Ignores trailing and leading dots, and atoms that consist of dots.

Example

(macro propertify (require "/path/to/elisp-propertify/index.js"))
(propertify (a.b 42))

a.b(42);

See the tests for fuller usage.

Full wrap

It's totally reasonable to wrap your whole program in this. Consider the eslisp compiler's --transform flag.

Limitations

If you need a computed member expression, you'll still need the . macro: For example, to get a.b[b.length], you'll need to write (. a.b b.length).

License

ISC.

Dependencies (0)

    Dev Dependencies (2)

    Package Sidebar

    Install

    npm i eslisp-propertify

    Weekly Downloads

    1

    Version

    0.3.0

    License

    ISC

    Last publish

    Collaborators

    • an