@n3okill/utils
Version:
Many javascript helpers
18 lines (17 loc) • 538 B
TypeScript
/**
* Interface that defines the properties of a chunk of balanced data in a string
*/
export interface BalancedDataBuffer {
start: number;
end: number;
body: Buffer;
pre: Buffer;
post: Buffer;
}
/**
* Return a Array<BalancedDataBuffer> mapping the chunks of 'open' and 'close' locations, if input buffer is unbalanced will return empty
* @param input Buffer
* @param open string
* @param close string
*/
export declare function balancedData(input: Buffer, open?: string, close?: string): BalancedDataBuffer[];