package-repo

1.0.0 • Public • Published

package-repo

Give this function a package.json object, or a path to a package.json file. It will look for a repository or repository.url key in the given object and attempt to parse it as a GitHub or BitBucket repository URL. See github-url-to-object and bitbucket-url-to-object for details about the object returned.

Installation

npm install package-repo --save

Usage

const packageRepo = require("package-repo")
 
packageRepo('./some/package.json')
// or
packageRepo(somePackage)
 
/*
{
  user: 'monkey',
  repo: 'business',
  branch: 'master',
  tarball_url: 'https://api.github.com/repos/monkey/business/tarball/master',
  clone_url: 'https://github.com/monkey/business',
  https_url: 'https://github.com/monkey/business',
  travis_url: 'https://travis-ci.org/monkey/business',
  api_url: 'https://api.github.com/repos/monkey/business'
  zip_url: 'https://github.com/monkey/business/archive/master.zip'
}
*/
 

Tests

npm install
npm test

Dependencies

Dev Dependencies

  • chai: BDD/TDD assertion library for node.js and the browser. Test framework agnostic.
  • mocha: simple, flexible, fun test framework
  • require-dir: Helper to require() directories.
  • snazzy: Format JavaScript Standard Style as Stylish (i.e. snazzy) output

License

MIT

Generated by package-json-to-readme

Package Sidebar

Install

npm i package-repo

Weekly Downloads

550

Version

1.0.0

License

MIT

Last publish

Collaborators

  • zeke