(call)
function calls
(call receiver? args?)Where:
Matching:
- regular calls, e.g.
x() - dynamic imports, e.g.
import()
Examples
Remove leftover debug logging before a release by finding calls to console.log.
(call (mem log console))Selects in lines { 1 } but not in { 2, 3 }:
console.log("debug", payload)
console.info("debug", payload)
logger.log("debug", payload)Find setTimeout calls that execute string code instead of a callback.
(call setTimeout (arg 1 (str)))Selects in lines { 1 } but not in { 2, 3 }:
setTimeout("window.location.reload()", 1000)
setTimeout(() => window.location.reload(), 1000)
setTimeout(() => {}, 0)Harden API requests by finding POST fetch calls that omit headers.
(call fetch
(:and
(arg 2 (obj (prop method (str "POST"))))
(:not (arg 2 (obj (prop headers))))))Selects in lines { 1 } but not in { 2, 3, 4 }:
fetch("/api/users", { method: "POST" })
fetch("/api/users", { method: "POST", headers: { "Content-Type": "application/json" } })
fetch("/api/users", { method: "GET" })
fetch("/api/users")Arguments
receiver
• Identifier: shorthand for (id)
• Pattern: shorthand for (id)
• (:kind) • (:ref) • (:text) • (arr) • (attr) • (bool) • (call) • (child) • (comp) • (export) • (fun) • (id) • (id+) • (import) • (jsx) • (mem) • (null) • (num) • (obj) • (of) • (prop) • (regex) • (regex+) • (str) • (str*) • (str+) • (tpl) • (tpl*) • (var) • (:into) • (:and) • (:or) • (:not) • (:replace) • (:capture)
args
• (arg)
• (:into) • (:and) • (:or) • (:not) • (:text) • (:kind) • (:replace) • (:capture)