UNPKG

@utilify/core

Version:

Modern, strongly typed, and safe utility function library for JavaScript and TypeScript. Includes type checking, manipulation of arrays, objects, strings, dates, colors, numbers, regular expressions, and more. Compatible with Browser, Node.js, Deno, and B

18 lines 726 B
/** * Returns elements before a given index in a string. * @param {string} string - The string to slice. * @param {number} index - The index. * @returns {string} The substring before the index. * @throws {TypeError} If input is not array-like or index is invalid. */ export default function before(string: string, index: number): string; /** * Returns elements before a given index in an array. * @template T * @param {T[]} array - The array to slice. * @param {number} index - The index. * @returns {T[]} The elements before the index. * @throws {TypeError} If input is not array-like or index is invalid. */ export default function before<T>(array: T[], index: number): T[]; //# sourceMappingURL=before.d.ts.map