(collection, values)
| 688 | } |
| 689 | |
| 690 | export function concatFactory(collection, values) { |
| 691 | const isKeyedCollection = isKeyed(collection); |
| 692 | const iters = [collection] |
| 693 | .concat(values) |
| 694 | .map((v) => { |
| 695 | if (!isCollection(v)) { |
| 696 | v = isKeyedCollection |
| 697 | ? keyedSeqFromValue(v) |
| 698 | : indexedSeqFromValue(Array.isArray(v) ? v : [v]); |
| 699 | } else if (isKeyedCollection) { |
| 700 | v = KeyedCollection(v); |
| 701 | } |
| 702 | return v; |
| 703 | }) |
| 704 | .filter((v) => v.size !== 0); |
| 705 | |
| 706 | if (iters.length === 0) { |
| 707 | return collection; |
| 708 | } |
| 709 | |
| 710 | if (iters.length === 1) { |
| 711 | const singleton = iters[0]; |
| 712 | if ( |
| 713 | singleton === collection || |
| 714 | (isKeyedCollection && isKeyed(singleton)) || |
| 715 | (isIndexed(collection) && isIndexed(singleton)) |
| 716 | ) { |
| 717 | return singleton; |
| 718 | } |
| 719 | } |
| 720 | |
| 721 | return new ConcatSeq(iters); |
| 722 | } |
| 723 | |
| 724 | export function flattenFactory(collection, depth, useKeys) { |
| 725 | const flatSequence = makeSequence(collection); |
no test coverage detected