Handle empty include/exclude arrays
parent
357653bb37
commit
2c35d5a8a8
|
@ -56,8 +56,8 @@ export default class Picker extends React.Component {
|
|||
}
|
||||
|
||||
for (let category of data.categories) {
|
||||
let isIncluded = props.include == undefined ? true : props.include.indexOf(category.name.toLowerCase()) > -1
|
||||
let isExcluded = props.exclude == undefined ? false : props.exclude.indexOf(category.name.toLowerCase()) > -1
|
||||
let isIncluded = props.include && props.include.length ? props.include.indexOf(category.name.toLowerCase()) > -1 : true
|
||||
let isExcluded = props.exclude && props.exclude.length ? props.exclude.indexOf(category.name.toLowerCase()) > -1 : false
|
||||
if (!isIncluded || isExcluded) { continue }
|
||||
|
||||
if (props.emojisToShowFilter) {
|
||||
|
@ -84,8 +84,8 @@ export default class Picker extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
let includeRecent = props.include == undefined ? true : props.include.indexOf('recent') > -1
|
||||
let excludeRecent = props.exclude == undefined ? false : props.exclude.indexOf('recent') > -1
|
||||
let includeRecent = props.include && props.include.length ? props.include.indexOf('recent') > -1 : true
|
||||
let excludeRecent = props.exclude && props.exclude.length ? props.exclude.indexOf('recent') > -1 : false
|
||||
if (includeRecent && !excludeRecent) {
|
||||
this.categories.unshift(RECENT_CATEGORY)
|
||||
}
|
||||
|
|
|
@ -39,8 +39,8 @@ function search(value, { emojisToShowFilter, maxResults, include, exclude } = {}
|
|||
pool = {}
|
||||
|
||||
for (let category of data.categories) {
|
||||
let isIncluded = include == undefined ? true : include.indexOf(category.name.toLowerCase()) > -1
|
||||
let isExcluded = exclude == undefined ? false : exclude.indexOf(category.name.toLowerCase()) > -1
|
||||
let isIncluded = include && include.length ? include.indexOf(category.name.toLowerCase()) > -1 : true
|
||||
let isExcluded = exclude && exclude.length ? exclude.indexOf(category.name.toLowerCase()) > -1 : false
|
||||
if (!isIncluded || isExcluded) { continue }
|
||||
|
||||
for (let emojiId of category.emojis) {
|
||||
|
|
Loading…
Reference in New Issue