@technobuddha/library
Version:
A large library of useful functions
19 lines (18 loc) • 562 B
TypeScript
/**
* Options for the {@link chop} function
* @group String
* @category Deconstruction
*/
export type ChopOptions = {
/** If true, the last block will be omitted if has insufficient characters **/
truncate?: boolean;
};
/**
* Break a string into equal sized segments of characters
* @param input - The string to break apart
* @param length - The length of each segment
* @returns Array of segments
* @group String
* @category Deconstruction
*/
export declare function chop(input: string, length: number, { truncate }?: ChopOptions): string[];