utils#intersect

release
Etienne Lemay 2016-07-22 16:04:30 -04:00
parent be1e6705c3
commit 7e9835dd80
1 changed files with 13 additions and 1 deletions

View File

@ -67,4 +67,16 @@ function getData(emoji, skin, sheetURL) {
return emojiData
}
export { getData, getSanitizedData }
function intersect(a, b) {
var aSet = new Set(a),
bSet = new Set(b),
intersection = null
intersection = new Set(
[...aSet].filter(x => bSet.has(x))
)
return Array.from(intersection)
}
export { getData, getSanitizedData, intersect }