UNPKG

bc-api-client

Version:

A client for the BigCommerce management API and app authentication

23 lines (22 loc) 826 B
/** * Split an array of strings into chunks by following logic * * 1. add length of each string + separatorSize to offset * 2. if result is greater than `maxLength`, start a new chunk * 3. otherwise, add the string to the current chunk until the chunk is of `chunkLength` * * This function to be used for splitting query params to avoid url length limit * * @param items array of strings * @param options * @param options.maxLength max length of the combined strings * @param options.chunkLength max length of each chunk * @param options.offset offset of the first chunk * @param options.separatorSize size of the separator */ export declare const chunkStrLength: (items: string[], options?: { maxLength?: number; chunkLength?: number; offset?: number; separatorSize?: number; }) => string[][];