         (tern-run-request #'tern-do-complete "completions" (point)))))
 
 (defun tern-do-complete (data offset)
-  (let ((cs (loop for elt across (cdr (assoc 'completions data)) collect (cdr (assoc 'name elt))))
-        (start (+ 1 offset (cdr (assoc 'from data))))
-        (end (+ 1 offset (cdr (assoc 'to data)))))
+  (let ((cs (loop for elt across (cdr (assq 'completions data)) collect (cdr (assq 'name elt))))
+        (start (+ 1 offset (cdr (assq 'from data))))
+        (end (+ 1 offset (cdr (assq 'to data)))))
     (setf tern-last-completions (list (buffer-substring-no-properties start end) start end cs))
     (completion-in-region start end cs)))
 

            (forward-char)))))

(defun tern-parse-function-type (data)
  (let ((type (cdr (assoc 'type data)))
        (name (or (cdr (assoc 'exprName data)) (cdr (assoc 'name data)) "fn")))
    (when (string-match-p "^fn(" type)
      (with-temp-buffer
        (insert type)

                      (push (cons (buffer-file-name) (point)) tern-find-definition-stack)
                      (let ((too-long (nthcdr 20 tern-find-definition-stack)))
                        (when too-long (setf (cdr too-long) nil)))
                      (tern-go-to-position (concat (tern-project-dir) (cdr (assq 'file data)))
                                           (1+ (cdr (assq 'start data)))))
                    "definition"
                    (point)
                    :full-file))
