New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

normalize-repo

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

normalize-repo

[![Build Status](https://travis-ci.com/krmax44/normalize-repo.svg?branch=master)](https://travis-ci.com/krmax44/normalize-repo) ![npm bundle size](https://img.shields.io/bundlephobia/min/normalize-repo?label=size) ![npm version](https://img.shields.io/npm

latest
Source
npmnpm
Version
1.1.3
Version published
Weekly downloads
20
-44.44%
Maintainers
1
Weekly downloads
 
Created
Source

Normalize Repo

Build Status npm bundle size npm version

Normalizes the repository object or string you typically find in package.json. It adheres to the specification and can parse everything you can also use as a value for repository.

Installation

yarn add normalize-repo

Examples

All values that repository

const normalizeRepo = require('normalize-repo');

normalizeRepo('github:krmax44/normalize-repo')

// output:
{
  url: 'https://github.com/krmax44/normalize-repo.git',
  shortcut: 'github:krmax44/normalize-repo',
  provider: 'github',
  owner: 'krmax44',
  name: 'normalize-repo'
}

You can also pass an object:

normalizeRepo({ url: 'https://github.com/krmax44/normalize-repo.git' });

A malformatted and incompliant input will throw an error:

try {
  // will throw an error, as only shortcut strings are allowed
  normalizeRepo('https://github.com/krmax44/normalize-repo.git');
} catch (error) {
  console.log(error);
}

Note: Only Github, Gitlab, Github Gist and Bitbucket repositories will return shortcut, provider, owner and name values.

FAQs

Package last updated on 12 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts