Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
filteredComponents (state) {
if (!state.search) {
return state.components
}
const search = state.search.toLowerCase()
const options = {
childrenPath: 'children',
onTrue: {
skipChildren: true
}
}
const result = filterDeep(state.components, component => {
return component.name
.toLowerCase()
.includes(search)
}, options)
// `filterDeep` returns `null` if nothing has been found,
// but we need at least an empty array for consistency.
return result || []
}
},