|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
737 bytes
|
| Line | |
|---|
| 1 | import { last } from './last.mjs';
|
|---|
| 2 | import { difference } from '../../array/difference.mjs';
|
|---|
| 3 | import { differenceWith as differenceWith$1 } from '../../array/differenceWith.mjs';
|
|---|
| 4 | import { flattenArrayLike } from '../_internal/flattenArrayLike.mjs';
|
|---|
| 5 | import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs';
|
|---|
| 6 |
|
|---|
| 7 | function differenceWith(array, ...values) {
|
|---|
| 8 | if (!isArrayLikeObject(array)) {
|
|---|
| 9 | return [];
|
|---|
| 10 | }
|
|---|
| 11 | const comparator = last(values);
|
|---|
| 12 | const flattenedValues = flattenArrayLike(values);
|
|---|
| 13 | if (typeof comparator === 'function') {
|
|---|
| 14 | return differenceWith$1(Array.from(array), flattenedValues, comparator);
|
|---|
| 15 | }
|
|---|
| 16 | return difference(Array.from(array), flattenedValues);
|
|---|
| 17 | }
|
|---|
| 18 |
|
|---|
| 19 | export { differenceWith };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.