client/staff/filters/sliceFilter.js
/*
    slices input array for pagination
    current - current pagination page
    limit - limit of items per page
*/
slices input array for pagination
current - current pagination page
limit - limit of items per page
slices input array for pagination current - current pagination page limit - limit of items per page
function sliceFilter() {
    return function(arr, current = 1, limit = 10) {
        if (!Array.isArray(arr) || current < 1 || limit < 1) {
            console.error('sliceFilter: wrong input');
            return arr;
        }
        return arr.slice((current - 1) * limit , current * limit);
    };
}
function sliceFilter ( ) { return function ( arr , current = 1 , limit = 10 ) { if ( ! Array . isArray ( arr ) || current < 1 || limit < 1 ) { console . error ( 'sliceFilter: wrong input' ) ; return arr ; } return arr . slice ( ( current - 1 ) * limit , current * limit ) ; } ; }
slices input array for pagination
current - current pagination page
limit - limit of items per page
slices input array for pagination current - current pagination page limit - limit of items per page