lodash APIs
- get
- isEmpty
- cloneDeep
- debounce
- omit
- isEqual
- find
- merge
- map
- filter
- throttle
- sortBy
- set
- isString
- isArray
- pick
- orderBy
- groupBy
- includes
- isObject
- noop
- findIndex
- isFunction
- isNil
- uniqueId
- pickBy
- uniq
- kebabCase
- without
- camelCase
- isNumber
- uniqBy
- isUndefined
- capitalize
- clone
- range
- omitBy
- remove
- forIn
- forEach
- reduce
- flatten
- zipObject
- mapValues
- concat
- trim
- castArray
- difference
- memoize
- keyBy
- assign
- each
- upperFirst
- chain
- sample
- isPlainObject
- has
- mapKeys
- isNull
- last
- isBoolean
- identity
- padStart
- head
- size
- conformsTo
- mergeWith
- transform
- uniqWith
- union
- toString
- reject
- snakeCase
- max
- min
- reverse
- slice
- isInteger
- startsWith
- first
- sumBy
- maxBy
- minBy
- _
- xor
- replace
- take
- endsWith
- toLower
- clamp
- toPairs
- some
- extend
- times
- flattenDeep
- escapeRegExp
- shuffle
- round
- toInteger
- isNaN
- unset
- VERSION
- nth
- flow
- sum
- isFinite
- values
- lowerCase
- deburr
- isEqualWith
- cloneDeepWith
- hasIn
- findLast
- findKey
- differenceBy
- pull
- findLastIndex
- partition
- at
- defer
- intersectionBy
- invert
- delay
- forOwn
- pullAt
- once
- sampleSize
- random
- defaults
- unescape
- keys
- toNumber
- wrap
- inRange
- join
- template
- split
- words
- toSafeInteger
- pullAllBy
- unionWith
- xorBy
- differenceWith
- indexOf
- multiply
- divide
- every
- toPath
- defaultTo
- isObjectLike
- intersection
- startCase
- sortedIndexBy
OtherRelated APIs
lodash#intersection JavaScript Examples
The following examples show how to use
lodash#intersection.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: helpers.js From rysolv with GNU Affero General Public License v3.0 | 5 votes |
filterIssues = (issues, filterParams) => {
const {
language: languageFilter,
price: priceFilter,
repo: repoFilter,
status: { closed, funded, unfunded },
type: { bug, feature },
} = filterParams;
let bugIssues = [];
let closedIssues = [];
let featureIssues = [];
let fundedIssues = [];
let unfundedIssues = [];
const filteredIssues = issues.filter(
({ fundedAmount, language: languages, repoName }) => {
const formattedLanguageFilter = languageFilter.map(({ value }) =>
value.toLowerCase(),
);
const formattedRepoFilter = repoFilter.map(({ value }) =>
value.toLowerCase(),
);
if (
!isEmpty(formattedLanguageFilter) &&
!languages.some(language =>
formattedLanguageFilter.includes(language.toLowerCase()),
)
) {
return false;
}
if (
!isEmpty(formattedRepoFilter) &&
!formattedRepoFilter.includes(repoName.toLowerCase())
) {
return false;
}
if (fundedAmount < priceFilter[0] || fundedAmount > priceFilter[1]) {
return false;
}
return true;
},
);
if (closed) {
closedIssues = filteredIssues.filter(
({ open: isOpen }) => isOpen === false,
);
}
if (funded) {
fundedIssues = filteredIssues.filter(
({ fundedAmount, open: isOpen }) => isOpen === true && fundedAmount,
);
}
if (unfunded) {
unfundedIssues = filteredIssues.filter(
({ fundedAmount, open: isOpen }) => isOpen === true && fundedAmount === 0,
);
}
if (bug) {
bugIssues = filteredIssues.filter(({ type }) => type === 'Bug');
}
if (feature) {
featureIssues = filteredIssues.filter(({ type }) => type === 'Feature');
}
const arr1 =
closed || funded || unfunded
? closedIssues.concat(fundedIssues.concat(unfundedIssues))
: filteredIssues;
const arr2 =
bug || feature ? bugIssues.concat(featureIssues) : filteredIssues;
return intersection(arr1, arr2);
}