Skip to content

(arg)

argument and parameter positions

clojure
(arg pos? val?)

Where:

  1. pos: position in the list (1-based) *
  2. val: value at that position *

Examples

Find zero-delay timers that can starve the main thread.

clojure
(call setTimeout (arg 2 (num 0)))

Selects in lines { 1 } but not in { 2, 3 }:

typescript
setTimeout(tick, 0)
setTimeout(tick, 250)
setInterval(tick, 0)

Identify request handlers when migrating server frameworks.

clojure
(fun _ (:and (arg 1 (id req)) (arg 2 (id res))))

Selects in lines { 1, 2 } but not in { 3 }:

typescript
function handle(req, res) {}
const handleArrow = (req, res) => {}
function reversed(res, req) {}

Find one-time event listeners that are safe to remove manually.

clojure
(call (mem addEventListener) (arg 3 (obj (prop once))))

Selects in lines { 1 } but not in { 2, 3 }:

typescript
button.addEventListener("click", onClick, { once: true })
window.addEventListener("scroll", onScroll, { passive: true })
document.addEventListener("keydown", onKey)

Arguments

pos

• Number

Does NOT support: CompositionFree-form SelectionRefinementReplacement

val

• Identifier: shorthand for (id)
• String: shorthand for (str)
(: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)

Copyright © 2022-present Semantic Works, Inc.