(call) - JavaScript
function calls
clojure
(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.
clojure
(call (mem log console))Selects in lines { 1 } but not in { 2, 3 }:
typescript
console.log("debug", payload)
console.info("debug", payload)
logger.log("debug", payload)Find setTimeout calls that execute string code instead of a callback.
clojure
(call setTimeout (arg 1 (str)))Selects in lines { 1 } but not in { 2, 3 }:
typescript
setTimeout("window.location.reload()", 1000)
setTimeout(() => window.location.reload(), 1000)
setTimeout(() => {}, 0)Harden API requests by finding POST fetch calls that omit headers.
clojure
(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 }:
typescript
fetch("/api/users", { method: "POST" })
fetch("/api/users", { method: "POST", headers: { "Content-Type": "application/json" } })
fetch("/api/users", { method: "GET" })
fetch("/api/users")