Skip to content

Instantly share code, notes, and snippets.

@ifree
Created June 23, 2014 09:13
Show Gist options
  • Save ifree/eb034ef34f5aa957e897 to your computer and use it in GitHub Desktop.
Save ifree/eb034ef34f5aa957e897 to your computer and use it in GitHub Desktop.
convert js array to lisp list
(defun js2-array-to-list (&optional node)
"convert array to list"
(let ((node (or node (js2-node-at-point)))
elems)
(unless (js2-var-init-node-p (js2-node-parent node))
(error "invalid node"))
(setq elems (js2-array-node-elems
(js2-var-init-node-initializer
(js2-node-parent node))))
(mapcar (lambda (x) (js2-node-string x)) elems)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment