Skip to content

(is)

kind constraints for functions and variable declarations

clojure
(is kind)

Where:

  1. kind: kind to match *

Matching:

  1. async functions, e.g. async function x() {}
  2. generator functions, e.g. function* x() {}
  3. const declarations, e.g. const x = 1
  4. let declarations, e.g. let x = 1
  5. var declarations, e.g. var x = 1

Examples

Audit async functions before changing error handling.

clojure
(fun _ _ (is async))

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

typescript
async function load() {}
const run = async () => {}
function sync() {}

Find generator utilities to replace with async iterators.

clojure
(fun _ _ (is generator))

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

typescript
function* ids() { yield 1 }
const gen = function* () { yield 2 }
function ids() { return [1] }

Locate const declarations that should be migrated to let.

clojure
(var _ _ (is const))

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

typescript
const token = "abc"
let retries = 3
var legacy = 1

Arguments

kind

"async"
"generator"
"var"
"let"
"const"

Does NOT support: CompositionFree-form SelectionRefinementReplacement

Copyright © 2022-present Semantic Works, Inc.