@n3okill/utils
Version:
Many javascript helpers
19 lines (18 loc) • 533 B
TypeScript
/**
* Interface that defines the properties of a chunk of balanced data in a string
*/
export interface BalancedData {
start: number;
end: number;
body: string;
pre: string;
post: string;
}
/**
* Return 'false' if input string is unbalanced, otherwise returns an array mapping the chunks of 'open' and 'close' locations
* @param input
* @param open
* @param close
* @returns {boolean | BalancedData[]}
*/
export declare function balancedData(input: string, open?: string, close?: string): BalancedData[];