How to use the sp2.sortByNotation function in sp2

To help you get started, we’ve selected a few sp2 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 phenyl / phenyl / modules / state / src / phenyl-state-finder.ts View on Github external
static find>(
    state: EntityState,
    query: WhereQuery
  ): ResponseEntity[] {
    const { entityName, where, sort, skip, limit } = query;
    let filtered = retrieve(this.getAll(state, entityName), where);

    if (sort != null) {
      filtered = sortByNotation(filtered, sort);
    }

    const skipVal = skip || 0;
    const limitVal = limit != null ? limit + skipVal : filtered.length;
    return filtered.slice(skipVal, limitVal);
  }
  /**