(value)
| 30 | // @pragma Construction |
| 31 | |
| 32 | constructor(value) { |
| 33 | const empty = emptyList(); |
| 34 | if (value === undefined || value === null) { |
| 35 | // eslint-disable-next-line no-constructor-return |
| 36 | return empty; |
| 37 | } |
| 38 | if (isList(value)) { |
| 39 | // eslint-disable-next-line no-constructor-return |
| 40 | return value; |
| 41 | } |
| 42 | const iter = IndexedCollection(value); |
| 43 | const size = iter.size; |
| 44 | if (size === 0) { |
| 45 | // eslint-disable-next-line no-constructor-return |
| 46 | return empty; |
| 47 | } |
| 48 | assertNotInfinite(size); |
| 49 | if (size > 0 && size < SIZE) { |
| 50 | // eslint-disable-next-line no-constructor-return |
| 51 | return makeList(0, size, SHIFT, undefined, new VNode(iter.toArray())); |
| 52 | } |
| 53 | // eslint-disable-next-line no-constructor-return |
| 54 | return empty.withMutations((list) => { |
| 55 | list.setSize(size); |
| 56 | iter.forEach((v, i) => list.set(i, v)); |
| 57 | }); |
| 58 | } |
| 59 | |
| 60 | static of(/*...values*/) { |
| 61 | return this(arguments); |
no test coverage detected