Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const currentPage = options.startingPage === undefined ? 0 : options.startingPage - 1;
// sets first page when route is loaded
const firstPage = currentPage === 0 ? 1 : currentPage + 1;
// chunk requests by indicated perPage param
const perPage = options.perPage || 25;
// store service methods (defaults to ember-data if nothing passed)
const store = options.store || get(this, 'store');
const storeFindMethod = options.storeFindMethod || 'query';
let infinityModel;
if (ExtendedInfinityModel) {
// if custom InfinityModel, then use as base for creating an instance
infinityModel = ExtendedInfinityModel.create();
} else {
infinityModel = InfinityModel.create();
}
// check if user passed in param w/ infinityModel, else default
const perPageParam = paramsCheck('perPageParam', options, infinityModel);
const pageParam = paramsCheck('pageParam', options, infinityModel);
const totalPagesParam = paramsCheck('totalPagesParam', options, infinityModel);
const countParam = paramsCheck('countParam', options, infinityModel);
const infinityCache = paramsCheck('infinityCache', options, infinityModel);
// create identifier for use in storing unique cached infinity model
let identifier = stringifyObjectValues(options);
delete options.startingPage;
delete options.perPage;
delete options.perPageParam;
delete options.pageParam;