Repository URL to install this package:
Version:
6.0.4 ▾
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// @todo not sure if this is fine to import here or if we move this elsewhere
const exotic_1 = require("exotic");
/**
* dead code eliminated
*/
if (process.env.NODE_ENV === 'development') {
try {
// exotic.EMPTY_ARRAY.isEmpty === true
// exotic.EMPTY_ARRAY.isEmpty === true
Object.defineProperty(Array.prototype, 'IS_EMPTY', {
enumerable: false,
configurable: false,
get() {
return this === exotic_1.EMPTY_ARRAY;
},
});
Object.defineProperty(Object.prototype, 'IS_EMPTY', {
enumerable: false,
configurable: false,
get() {
return this === exotic_1.EMPTY_OBJ;
},
});
}
catch (notWritableException) {
// ignore, dev
}
}
const fromPropsToLongestArray = (props) => {
// let best = ['empty']
let best = [];
Object.keys(props)
// should be able to sort based on common naming
// should be able to do a more fancy reduce or sortby .length & .pop/find
.forEach(key => {
const list = props[key];
if (exotic_1.isArray(list) === false) {
return;
}
if (list.length > best.length) {
best = list;
}
});
return best;
};
exports.fromPropsToLongestArray = fromPropsToLongestArray;
exports.default = fromPropsToLongestArray;
//# sourceMappingURL=fromPropsToLongestArray.js.map