npm-description

Fetch a package's description from NPM

Usage no npm install needed!

<script type="module">
  import npmDescription from 'https://cdn.skypack.dev/npm-description';
</script>

README

npm-description

npm typescript GitHub stars Twitter Follow

Fetch a package's description from NPM.

Uses cross-fetch-json to support usage in both brower and node.

Installation

yarn add npm-description
npm install npm-description

API

Usage

import { getDescription, getDescriptions } from "npm-description";

getDescription("chalk").then((result) => {
  console.log(result); // "Terminal string styling done right"
});

getDescriptions(["chalk", "commander"]).then((result) => {
  console.log(result.chalk); // "Terminal string styling done right"
  console.log(result.commander); // "the complete solution for node.js command-line programs"
});

Types

import { getDescription, getDescriptions, Descriptions } from "npm-description";

function getDescription(name: string): Promise<string | undefined>;

function getDescriptions(names: string[]): Promise<Descriptions>;

export type Descriptions = {
  [name: string]: string | undefined;
};

Dependenciesdependencies


Dev DependenciesDavid


License license

MIT


Related Packages: