Function filter

  • Filter data based on parsed query

    Example

    const data = ['Hello', 'World', 'Foo', 'Bar']
    const parsed = parse('Hello OR (World AND Bar)')
    const filtered = filter(parsed, data)
    console.log(filtered) // ['Hello', 'World', 'Bar']

    Parameters

    • parsed: ParserToken[]

      parsed query

    • data: string[]

      data to filter

    • Optional map: ((item) => string)

      map function to apply to data before filtering

        • (item): string
        • Parameters

          • item: string

          Returns string

    Returns string[]

    filtered data

  • Type Parameters

    • T

    Parameters

    • parsed: ParserToken[]
    • data: T[]
    • map: ((item) => string)
        • (item): string
        • Parameters

          • item: T

          Returns string

    Returns string[]

Generated using TypeDoc