npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

gh-canonical-repository

2.1.0

@juliangruber

npmHomeRepoSnykSocket
Downloads:15
$ npm install gh-canonical-repository
DailyWeeklyMonthlyYearly

gh-canonical-repository

Get the canonical GitHub repository of a git clone.

Calls back with the repository name it read from the local git config first, then with what it resolved via the public GitHub Api.

Use this for cases where you cloned a repository like Level/leveldown with lowercase level but need its actual name.

Example

const canonical = require('gh-canonical-repository')

canonical(
  process.argv[2],
  (err, guess) => {
    if (err) throw err
    console.log('guess', guess)
  },
  (err, repo) => {
    if (err) throw err
    console.log('repo', repo)
  }
)
$ node example.js ~/dev/level/leveldown
guess [ 'level', 'leveldown' ]
repo [ 'Level', 'leveldown' ]

Installation

$ npm install gh-canonical-repository

API

canonical(dir[, onGuess], cb)

canonical.promise(dir)

License

MIT