Skip to content

Commit

Permalink
Replace lodash.isarray in favor of Array.isArray. Closes #46
Browse files Browse the repository at this point in the history
  • Loading branch information
maslianok committed Oct 4, 2018
1 parent 18d1cd1 commit 7159cd7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
10 changes: 3 additions & 7 deletions lib/index.js
Expand Up @@ -27,14 +27,10 @@ var _lodash3 = require('lodash.throttle');

var _lodash4 = _interopRequireDefault(_lodash3);

var _lodash5 = require('lodash.isarray');
var _lodash5 = require('lodash.isfunction');

var _lodash6 = _interopRequireDefault(_lodash5);

var _lodash7 = require('lodash.isfunction');

var _lodash8 = _interopRequireDefault(_lodash7);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
Expand All @@ -61,7 +57,7 @@ var styles = {
*/
function convertChildrenToArray(children) {
if (!children) return [];
if (!(0, _lodash6.default)(children)) return [children];
if (!Array.isArray(children)) return [children];
return children;
}

Expand Down Expand Up @@ -130,7 +126,7 @@ var ResizeDetector = function (_PureComponent) {
return convertChildrenToArray(children).filter(function (child) {
return !!child;
}).map(function (child, key) {
if ((0, _lodash8.default)(child)) return (0, _react.cloneElement)(child(width, height), { key: key });
if ((0, _lodash6.default)(child)) return (0, _react.cloneElement)(child(width, height), { key: key });
if ((0, _react.isValidElement)(child)) return (0, _react.cloneElement)(child, { width: width, height: height, key: key });
return child;
});
Expand Down
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -64,7 +64,6 @@
},
"dependencies": {
"lodash.debounce": "^4.0.8",
"lodash.isarray": "^4.0.0",
"lodash.isfunction": "^3.0.9",
"lodash.throttle": "^4.1.1",
"prop-types": "^15.6.1",
Expand Down
3 changes: 1 addition & 2 deletions src/index.js
Expand Up @@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
import ResizeObserver from 'resize-observer-polyfill';
import debounce from 'lodash.debounce';
import throttle from 'lodash.throttle';
import isArray from 'lodash.isarray';
import isFunction from 'lodash.isfunction';

const listMode = { debounce, throttle };
Expand All @@ -22,7 +21,7 @@ const styles = {
*/
function convertChildrenToArray(children) {
if (!children) return [];
if (!isArray(children)) return [children];
if (!Array.isArray(children)) return [children];
return children;
}

Expand Down

0 comments on commit 7159cd7

Please sign in to comment.