Skip to content

(:not)

logical NOT - matches when the nested selector does NOT match (complement)

clojure
(:not val)

Where:

  1. val: what should NOT match *

Behavior

  • Negates the result of its child selector.
  • Placement matters: (:not (arg _ (obj))) means 'no args match obj', while (arg _ (:not (obj))) means 'an arg exists that is not obj'.

Examples

Find objects that lack a specific property.

clojure
(obj (:not (prop error)))

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

typescript
const response1 = { data: users }
const response2 = { data: users, error: null }
const response3 = { status: 'ok' }

Locate function calls without any arguments.

clojure
(call refresh (:not (arg)))

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

typescript
refresh()
refresh(true)
poll()

Find array elements that are not string literals.

clojure
(arr (el _ (:not (str))))

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

typescript
const arr1 = [1, 2, 3]
const arr2 = ['a', 'b']
const arr3 = [1, 'a', 2]

Arguments

val

inherit

Copyright © 2022-present Semantic Works, Inc.