UNPKG

@ecomplus/utils

Version:

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

21 lines 924 B
export default filterByParentSlug; /** * @method * @memberof ecomUtils * @name filterByParentSlug * @description Filter categories list by parent category slug. * @param {Array} categories - List of category objects * @param {string} slug - Parent category slug value * @returns {Array} * * @example * // Full object ref.: https://developers.e-com.plus/docs/api/#/store/categories/ * const categories = [] * categories.push({ name: 'PCs', slug: 'pcs', parent: { name: 'Info', slug: 'info' } }) * categories.push({ name: 'Shirts', slug: 'shirts', parent: { name: 'Clothes', slug: 'clothes' } }) * categories.push({ name: 'Info', slug: 'info' }) * ecomUtils.filterByParentSlug(categories, 'info') * // => [ { name: 'PCs', slug: 'pcs', parent: { name: 'Info', slug: 'info' } } ] */ declare function filterByParentSlug(categories: any[], slug: string): any[]; //# sourceMappingURL=filter-by-parent-slug.d.ts.map