Skip to content

(num)

numeric literals

clojure
(num val?)

Where:

  1. val: numeric value or range to match *

Behavior

  • Matches integer literals only.
  • Supports range matching with inclusive bounds using the .. syntax.

Examples

Find magic numbers in timeout configurations before extracting them to constants.

clojure
(call setTimeout (arg 2 (num 1000..5000)))

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

typescript
setTimeout(tick, 1000)
setTimeout(poll, 5000)
setTimeout(refresh, 10000)

Locate HTTP status codes for error handling by range.

clojure
(num 400..499)

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

typescript
if (status === 404) { }
if (status === 500) { }
if (code === 403) { }

Find array access with hardcoded indices to refactor.

clojure
(mem (comp (num 0)))

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

typescript
const first = items[0]
const second = items[1]
const value = obj[key]

Arguments

val

• Number • Numeric Range

Does NOT support: CompositionFree-form SelectionRefinementReplacement

Copyright © 2022-present Semantic Works, Inc.