eslisp-propertify [][1] [][2] [][3]

September 24, 2015 Ā· View on GitHub

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.