Skip to content

(call)

function calls

clojure
(call receiver? args?)

Where:

  1. receiver: the function being called (the x in x()) *
  2. args: arguments supplied to the call *

Matching:

  1. regular calls, e.g. x()
  2. 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")

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)

Copyright © 2022-present Semantic Works, Inc.