import { minWith } from "https://dotland.deno.dev/std@0.181.0/collections/min_with.ts";
Returns the first element having the smallest value according to the provided comparator or undefined if there are no elements
Examples
Example 1
Example 1
import { minWith } from "https://deno.land/std@0.181.0/collections/min_with.ts";
import { assertEquals } from "https://deno.land/std@0.181.0/testing/asserts.ts";
const people = ["Kim", "Anna", "John"];
const smallestName = minWith(people, (a, b) => a.length - b.length);
assertEquals(smallestName, "Kim");