Skip to content

(:into) - Operators

refine the selection to an inner value

clojure
(:into val?)

Where:

  1. val: predicate (omit to select whatever appears at this location) *

Guides

Behavior

  • Applied to a list, the entire list is selected
  • Applied to an element in a list, all matching elements are selected
  • May be applied multiple times in a query at different locations

Examples

Extract all import specifiers from a specific module.

clojure
(import react (:into))

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

typescript
import { useState, useEffect } from 'react'
import $ from 'jquery'
import { render } from 'react'

Find object property keys to rename them.

clojure
(obj (prop (:into oldKey)))

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

typescript
const config = { oldKey: 1, newKey: 2 }
const settings = { oldKey: 3 }

Locate array elements that are function expressions for refactoring.

clojure
(arr (el _ (:into (fun))))

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

typescript
const callbacks = [() => {}, function() {}, processData]
const numbers = [1, 2, 3]

Extract all JSX attribute values for sanitization audit.

clojure
(jsx div (attr _ (:into)))

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

typescript
<div className="box" onClick={handler} />
<span title="text" />

Arguments

val

  1. inherit

Copyright © 2022-present Semantic Works, Inc.