@yookue/ts-lang-utils
    Preparing search index...

    Function count

    • Returns the count of elements in the given array which match the given filter

      Type Parameters

      • E

      Parameters

      • Optionalarray: null | E[] | readonly E[]

        the array to inspect

      • Optionalpredicate: (value: E, index: number) => boolean

        the function to filter the given array

      Returns number

      the count of elements in the given array which match the given filter

      David Hsing

      count(['foo', 'bar', 'foobar'], value => value.includes('foo'));    // 2