How to use the @lskjs/utils/omitEmpty function in @lskjs/utils

To help you get started, we’ve selected a few @lskjs/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lskjs / lskjs / packages / mobx / src / stores / FetchStore.js View on Github external
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;
    }