How to use the qs/lib/parse function in qs

To help you get started, we’ve selected a few qs 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 SyneticNL / Hyral / src / Core / Transformers / JsonApi / Response / Resource / normalizePaging.js View on Github external
export default function normalizePaging(response) {
  if (!response.links || !response.links.last) {
    return {
      count: 0,
      pages: 0,
    };
  }

  const query = parse(
    url.parse(response.links.last).query,
  );

  const numPages = parseInt(query.page.number, 10);
  const numPerPage = parseInt(query.page.size, 10);

  return {
    count: numPages * numPerPage,
    pages: numPages,
  };
}

qs

A querystring parser that supports nesting and arrays, with a depth limit

BSD-3-Clause
Latest version published 1 month ago

Package Health Score

91 / 100
Full package analysis