1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | 'use strict';
|
11 |
|
12 | var _prodInvariant = require('./reactProdInvariant');
|
13 |
|
14 | var invariant = require('fbjs/lib/invariant');
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 | function accumulate(current, next) {
|
24 | !(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulate(...): Accumulated items must be not be null or undefined.') : _prodInvariant('29') : void 0;
|
25 |
|
26 | if (current == null) {
|
27 | return next;
|
28 | }
|
29 |
|
30 |
|
31 |
|
32 | if (Array.isArray(current)) {
|
33 | return current.concat(next);
|
34 | }
|
35 |
|
36 | if (Array.isArray(next)) {
|
37 | return [current].concat(next);
|
38 | }
|
39 |
|
40 | return [current, next];
|
41 | }
|
42 |
|
43 | module.exports = accumulate; |
\ | No newline at end of file |