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