Docs@skmtc/core

Files and imports

FUNCTION

matchDefinitions

@skmtc/core 0.63.4

The neutral name/type filter every language's findDefinitions shares. The language passes its definition list and a typeOf extractor - the one lang-specific bit, which narrows to the language's Identifier subclass to read the typed type (returned here as the opaque string).

  • no name and no type → returns all (the whole list; the former listDefinitions).
  • otherwise → the matching subset, or undefined when nothing matches.

Signature

import { matchDefinitions } from '@skmtc/core'

matchDefinitions(
  all: DefinitionBase[],
  query: FindDefinitionsQuery | undefined,
  typeOf: (identifier: IdentifierBase) => string | undefined
): DefinitionBase[] | undefined

Parameters

all, DefinitionBase[] required
query, FindDefinitionsQuery | undefined required
typeOf, (identifier: IdentifierBase) => string | undefined required

Returns

DefinitionBase[] | undefined