INNER CODE UNIT · JavaScript

buildResult

aravindnc/mongoose-paginate-v2 · src/index.js:277

  function buildResult(count, docs) {
    if (pagination !== true) {
      count = docs.length;
    }

    const meta = {
      [labelTotal]: count,
    };

    let result;

    if (typeof offset !== 'undefined') {
      meta.offset = offset;
      page = Math.ceil((offset + 1) / limit);
    }

    const pages = limit > 0 ? Math.ceil(count / limit) || 1 : null;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…