add babelHelpers.toArray to polyfill

Reviewed By: yungsters, davidaurelio

Differential Revision: D2844203

fb-gh-sync-id: 6e76ed51265150108ef91ca64c5c5d930f14982e
This commit is contained in:
Jan Kassens 2016-01-20 10:25:23 -08:00 committed by facebook-github-bot-3
parent 5c10b5a84f
commit 52c2533b66
1 changed files with 5 additions and 1 deletions

View File

@ -11,7 +11,7 @@
/* eslint-disable strict */ /* eslint-disable strict */
// Created by running: // Created by running:
// require('babel-core').buildExternalHelpers('_extends classCallCheck createClass createRawReactElement defineProperty get inherits interopRequireDefault interopRequireWildcard objectWithoutProperties possibleConstructorReturn slicedToArray taggedTemplateLiteral toConsumableArray '.split(' ')) // require('babel-core').buildExternalHelpers('_extends classCallCheck createClass createRawReactElement defineProperty get inherits interopRequireDefault interopRequireWildcard objectWithoutProperties possibleConstructorReturn slicedToArray taggedTemplateLiteral toArray toConsumableArray '.split(' '))
// then replacing the `global` reference in the last line to also use `this`. // then replacing the `global` reference in the last line to also use `this`.
// //
// actually, that's a lie, because babel6 omits _extends and createRawReactElement // actually, that's a lie, because babel6 omits _extends and createRawReactElement
@ -216,6 +216,10 @@
})); }));
}; };
babelHelpers.toArray = function (arr) {
return Array.isArray(arr) ? arr : Array.from(arr);
};
babelHelpers.toConsumableArray = function (arr) { babelHelpers.toConsumableArray = function (arr) {
if (Array.isArray(arr)) { if (Array.isArray(arr)) {
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];