Skip to content

Example with View doesn't work #13

@metronom72

Description

@metronom72

The next code doesn't work. It mostly from the example

import NpmApi from 'npm-api';

export const search = async (query) => {
  try {
    const npm = new NpmApi();
    debugger;
    let view = npm.view('listAll');
    let pkg = await view.query({
      // group_level: 4,
      startkey: JSON.stringify(['react']),
      endkey: JSON.stringify(['react', {}])
    });
    debugger
    if (pkg.length > 0) {
      let val = pkg[0].value;
      let latest = val.versions[val['dist-tags'].latest];
    }
    debugger
  } catch (err) {
    console.log(err);
    throw err;
  }
}

I know that package react ixists, but code upper there shows that such package doesn't exist.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions