Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/shinnn/parse-user-repo

Parse a username/repo string
https://github.com/shinnn/parse-user-repo

Last synced: 27 days ago
JSON representation

Parse a username/repo string

Awesome Lists containing this project

README

        

# parse-user-repo

[![npm version](https://img.shields.io/npm/v/parse-user-repo.svg)](https://www.npmjs.com/package/parse-user-repo)
[![Build Status](https://travis-ci.com/shinnn/parse-user-repo.svg?branch=master)](https://travis-ci.com/shinnn/parse-user-repo)
[![Coverage Status](https://img.shields.io/coveralls/shinnn/parse-user-repo.svg)](https://coveralls.io/github/shinnn/parse-user-repo?branch=master)

Parse a `username/repo` string

## Installation

[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/about-npm/).

```
npm install parse-user-repo
```

## API

```javascript
import parseUserRepo from 'parse-user-repo';
```

### parseUserRepo(*str*)

*str*: `string` (`user/repo` style repository identifier, for example → `'holman/spark'`)
Return: `Object` (`{username: ..., repo: ...}`)

It extracts a username and a repository name from a `user/repo` string and creates an `Object`.

```javascript
parseUserRepo('gohugoio/hugo'); //=> {username: 'gohugoio', repo: 'hugo'}
```

## License

[ISC License](./LICENSE) © 2018 Shinnosuke Watanabe