parse-pkg-name
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

Parse package name Travis CI Build Status

Parse a package name, returning the name and org parts.

NPM Badge

Install

npm install parse-pkg-name

Usage

const parsePackageName = require("parse-pkg-name");
 
parsePackageName("a");
//=> { org: undefined, name: "a" }
 
parsePackageName("@a/b");
//=> { org: "a", name: "b" }
 
parsePackageName.from({ org: undefined, name: "a" })
//=> "a"
 
parsePackageName.from({ org: "a", name: "b" })
//=> "@a/b"

API

parsePackageName(name)

name

Type: string

The package name to parse.

parsePackageName(data)

data

Type: object

The parsed package data.

Upgrading from 1.x

  • Minimum supported version is now Node.js 10.

Readme

Keywords

Package Sidebar

Install

npm i parse-pkg-name

Weekly Downloads

5

Version

2.0.0

License

MIT

Unpacked Size

4.52 kB

Total Files

6

Last publish

Collaborators

  • richienb