Repository URL to install this package:
|
Version:
0.0.15 ▾
|
import { toNumber } from 'exotic';
/**
* @todo @@packages @action
*/
export function setPageLimit(productLimits, limit) {
function checkProductLimit(item) {
item.isDisabled = toNumber(item.label) < limit ? false : true;
return item;
}
function pagePerProductSorting(first, second) {
const firstLabel = toNumber(first.label);
const secondLabel = toNumber(second.label);
if (firstLabel < secondLabel) {
return -1;
}
if (firstLabel > secondLabel) {
return 1;
}
return 0;
}
const productLimitsPerPage = productLimits.filter(checkProductLimit);
return productLimitsPerPage.sort(pagePerProductSorting);
}
//# sourceMappingURL=PageLimit.js.map