|
Last change
on this file since a762898 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
251 bytes
|
| Rev | Line | |
|---|
| [a762898] | 1 | function differenceBy(firstArr, secondArr, mapper) {
|
|---|
| 2 | const mappedSecondSet = new Set(secondArr.map(item => mapper(item)));
|
|---|
| 3 | return firstArr.filter(item => {
|
|---|
| 4 | return !mappedSecondSet.has(mapper(item));
|
|---|
| 5 | });
|
|---|
| 6 | }
|
|---|
| 7 |
|
|---|
| 8 | export { differenceBy };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.