import { array } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { filter } = array;
Given a Predicate or Refinement, apply the predicate or refinement to every value in an array, removing (and refining) the elements that the predicate or refinement return false for.
Examples
Example 1
Example 1
import * as A from "./array.ts";
import { pipe } from "./fn.ts";
const result = pipe(
A.array(1, 2, 3, 4, 5, 6),
A.filter(n => n % 2 === 0),
); // [2, 4, 6]
Type Parameters
B extends A
Parameters
predicate: (a: A, index: number) => boolean