diff options
Diffstat (limited to 'node_modules/react-dom/lib/accumulateInto.js')
-rw-r--r-- | node_modules/react-dom/lib/accumulateInto.js | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/node_modules/react-dom/lib/accumulateInto.js b/node_modules/react-dom/lib/accumulateInto.js deleted file mode 100644 index 8ea8f9e12..000000000 --- a/node_modules/react-dom/lib/accumulateInto.js +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright 2014-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * - */ - -'use strict'; - -var _prodInvariant = require('./reactProdInvariant'); - -var invariant = require('fbjs/lib/invariant'); - -/** - * Accumulates items that must not be null or undefined into the first one. This - * is used to conserve memory by avoiding array allocations, and thus sacrifices - * API cleanness. Since `current` can be null before being passed in and not - * null after this function, make sure to assign it back to `current`: - * - * `a = accumulateInto(a, b);` - * - * This API should be sparingly used. Try `accumulate` for something cleaner. - * - * @return {*|array<*>} An accumulation of items. - */ - -function accumulateInto(current, next) { - !(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : _prodInvariant('30') : void 0; - - if (current == null) { - return next; - } - - // Both are not empty. Warning: Never call x.concat(y) when you are not - // certain that x is an Array (x could be a string with concat method). - if (Array.isArray(current)) { - if (Array.isArray(next)) { - current.push.apply(current, next); - return current; - } - current.push(next); - return current; - } - - if (Array.isArray(next)) { - // A bit too dangerous to mutate `next`. - return [current].concat(next); - } - - return [current, next]; -} - -module.exports = accumulateInto;
\ No newline at end of file |