UNPKG

@ecomplus/utils

Version:

JS utility functions to E-Com Plus (not only) related apps

24 lines 882 B
export default categoriesList; /** * @method * @memberof ecomUtils * @name categoriesList * @description Parse category tree string to list of categories names. * @param {Object.<string, *>|string} product - Product object body or category tree string * @returns {Array} * * @example * // Can be a category tree, like: * const categoryTree = 'Quarto > Cama > Travesseiros' * // So use categoryTree is parameter of function categoriesList, like: * ecomUtils.categoriesList(categoryTree) * // => ["Quarto", "Cama", "Travesseiros"] * // Or can be a product body object like: * const product = { name: 'Ultimate', categories: [{name: 'Cadeira Gamer'},{name: 'Periféricos'}]} * ecomUtils.categoriesList(product) * => ["Cadeira Gamer"] */ declare function categoriesList(product: { [x: string]: any; } | string): any[]; //# sourceMappingURL=categories-list.d.ts.map