Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async find({ skip, limit, __cancelToken } = {}) {
if (!this.api) throw '!api';
if (!this.api.find) throw '!api.find';
let params = getFindParams(this);
if (this.getFindParams) params = this.getFindParams(this, params);
const raw = await this.api.find({
count: 1,
...omitEmpty(params),
limit,
skip,
__cancelToken,
});
let items;
let count;
if (Array.isArray(raw)) {
// console.warn('pack lost, raw != {data}');
items = raw;
count = raw.count >= 0 ? raw.count : null;
} else {
items = raw.data || raw.items || [];
count = raw.count >= 0 ? raw.count : null;
}