UNPKG

@scayle/storefront-core

Version:

Collection of essential utilities to work with the Storefront API

17 lines (16 loc) 554 B
/** * Splits a string by a separator and removes any empty strings from the resulting array. * * @param value The string to split. * @param separator The separator to use. Defaults to '/'. * @returns An array of non-empty strings. * * @example * ```typescript * splitAndRemoveEmpty("a/b/c") // ["a", "b", "c"] * splitAndRemoveEmpty("a//b/c", "/") // ["a", "b", "c"] * splitAndRemoveEmpty("a/b//", "/") // ["a", "b"] * ``` */ declare const splitAndRemoveEmpty: (value: string, separator?: string) => string[]; export { splitAndRemoveEmpty };