UNPKG

@ayonli/jsext

Version:

A JavaScript extension package for building strong and modern applications.

19 lines (18 loc) 1.28 kB
import { RealArrayLike } from "../types.ts"; /** Counts the occurrence of the element in the array-like object. */ export declare function count<T>(arr: RealArrayLike<T>, item: T): number; /** * Performs a shallow compare to another array and see if it contains the same elements as * this array-like object. */ export declare function equals<T>(arr1: RealArrayLike<T>, arr2: RealArrayLike<T>): boolean; /** Checks if the array-like object contains another array as a slice of its contents. */ export declare function includeSlice<T>(arr: RealArrayLike<T>, slice: RealArrayLike<T>): boolean; /** Checks if the array-like object starts with the given prefix. */ export declare function startsWith<T>(arr: RealArrayLike<T>, prefix: RealArrayLike<T>): boolean; /** Checks if the array-like object ends with the given suffix. */ export declare function endsWith<T>(arr: RealArrayLike<T>, suffix: RealArrayLike<T>): boolean; /** Breaks the array-like object into smaller chunks according to the given delimiter. */ export declare function split<T>(arr: RealArrayLike<T>, delimiter: T): RealArrayLike<T>[]; /** Breaks the array-like object into smaller chunks according to the given length. */ export declare function chunk<T>(arr: RealArrayLike<T>, length: number): RealArrayLike<T>[];