|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
833 bytes
|
| Rev | Line | |
|---|
| [a762898] | 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|---|
| 4 |
|
|---|
| 5 | const last = require('../../array/last.js');
|
|---|
| 6 | const uniq = require('../../array/uniq.js');
|
|---|
| 7 | const uniqBy = require('../../array/uniqBy.js');
|
|---|
| 8 | const ary = require('../../function/ary.js');
|
|---|
| 9 | const flattenArrayLike = require('../_internal/flattenArrayLike.js');
|
|---|
| 10 | const isArrayLikeObject = require('../predicate/isArrayLikeObject.js');
|
|---|
| 11 | const iteratee = require('../util/iteratee.js');
|
|---|
| 12 |
|
|---|
| 13 | function unionBy(...values) {
|
|---|
| 14 | const lastValue = last.last(values);
|
|---|
| 15 | const flattened = flattenArrayLike.flattenArrayLike(values);
|
|---|
| 16 | if (isArrayLikeObject.isArrayLikeObject(lastValue) || lastValue == null) {
|
|---|
| 17 | return uniq.uniq(flattened);
|
|---|
| 18 | }
|
|---|
| 19 | return uniqBy.uniqBy(flattened, ary.ary(iteratee.iteratee(lastValue), 1));
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | exports.unionBy = unionBy;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.