From 52c2533b664672f957e918cea3b27350fd9b4628 Mon Sep 17 00:00:00 2001 From: Jan Kassens Date: Wed, 20 Jan 2016 10:25:23 -0800 Subject: [PATCH] add babelHelpers.toArray to polyfill Reviewed By: yungsters, davidaurelio Differential Revision: D2844203 fb-gh-sync-id: 6e76ed51265150108ef91ca64c5c5d930f14982e --- .../react-packager/src/Resolver/polyfills/babelHelpers.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packager/react-packager/src/Resolver/polyfills/babelHelpers.js b/packager/react-packager/src/Resolver/polyfills/babelHelpers.js index e028a7820..de54ebc2c 100644 --- a/packager/react-packager/src/Resolver/polyfills/babelHelpers.js +++ b/packager/react-packager/src/Resolver/polyfills/babelHelpers.js @@ -11,7 +11,7 @@ /* eslint-disable strict */ // 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`. // // 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) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];