Skip to content

Extracts the repo URL from a package.json object

License

Notifications You must be signed in to change notification settings

sindresorhus/repo-url-from-package

Repository files navigation

repo-url-from-package

Extracts the repo URL from a package.json object

Install

npm install repo-url-from-package

Usage

import repoUrlFromPackage from 'repo-url-from-package';
import packageJson from './package.json' with {type: 'json'};

const {url} = repoUrlFromPackage(packageJson);

console.log(url);
//=> 'https://github.com/sindresorhus/repo-url-from-package'

API

repoUrlFromPackage(packageJson)

Returns an object with the possible parsed url and an array of any warnings.

packageJson

Type: object

A package.json object.