Skip to content

(bin)

binary expressions like a + b or a && b

clojure
(bin operator left? right?)

Where:

  1. operator: binary operator token (e.g., +, &&, ===) *
  2. left: left-hand operand *
  3. right: right-hand operand *

Matching:

  1. arithmetic operators, e.g. a + b
  2. logical operators, e.g. a && b
  3. comparison operators, e.g. a === b

Behavior

  • The operator must match exactly (e.g., == vs ===).

Examples

Find string concatenations that build URLs from user input.

clojure
(bin + (str /https?:\/\//) (id userInput))

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

typescript
const url1 = "https://api.example.com/" + userInput
const url2 = "https://api.example.com/" + userId
const url3 = baseUrl + userInput

Locate non-strict equality checks against null.

clojure
(bin == _ (null))

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

typescript
if (value == null) { }
if (value === null) { }
if (value == undefined) { }

Find guard conditions that combine feature flags with auth checks.

clojure
(bin && (id featureEnabled) (id isAuthenticated))

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

typescript
if (featureEnabled && isAuthenticated) { }
if (featureEnabled || isAuthenticated) { }
if (isAuthenticated && featureEnabled) { }

Arguments

operator

• Identifier

Does NOT support: CompositionFree-form SelectionRefinementReplacement

left

(: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)

right

(: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.