# original

> Generate the origin from an URL or check if two URL/Origins are the same

Latest version **1.0.2** (published 2018-08-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install original
pnpm add original
yarn add original
bun add original
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2018-08-06 |
| First published | 2014-10-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/original) |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Arnout Kazemier |
| Maintainers | 3rdeden, unshift, v1 |
| Keywords | origin, url, parse |

## Links

- npm: https://www.npmjs.com/package/original
- Repository: https://github.com/unshiftio/original
- Homepage: https://github.com/unshiftio/original#readme
- Issues: https://github.com/unshiftio/original/issues
- npm.io page: https://npm.io/package/original

## Dependencies (1)

- [url-parse](https://npm.io/package/url-parse.md) ^1.4.3

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2018-08-06
- 1.0.1 — 2018-05-15
- 1.0.0 — 2015-10-30
- 0.0.8 — 2014-12-09
- 0.0.7 — 2014-12-06
- 0.0.6 — 2014-11-09
- 0.0.5 — 2014-10-30
- 0.0.4 — 2014-10-15
- 0.0.3 — 2014-10-13
- 0.0.2 — 2014-10-09
- 0.0.1 — 2014-10-08
- 0.0.0 — 2014-10-04

## README

# origin(al)

[![Made by unshift](https://img.shields.io/badge/made%20by-unshift-00ffcc.svg?style=flat-square)](http://unshift.io)[![Version npm](http://img.shields.io/npm/v/original.svg?style=flat-square)](http://browsenpm.org/package/original)[![Build Status](http://img.shields.io/travis/unshiftio/original/master.svg?style=flat-square)](https://travis-ci.org/unshiftio/original)[![Dependencies](https://img.shields.io/david/unshiftio/original.svg?style=flat-square)](https://david-dm.org/unshiftio/original)[![Coverage Status](http://img.shields.io/coveralls/unshiftio/original/master.svg?style=flat-square)](https://coveralls.io/r/unshiftio/original?branch=master)[![IRC channel](http://img.shields.io/badge/IRC-irc.freenode.net%23unshift-00a8ff.svg?style=flat-square)](http://webchat.freenode.net/?channels=unshift)

Original generates the origin URL for a given URL or URL object. In addition to
that it also comes with a simple `same` function to check if two URL's have the
same origin.

## Install

This module is browserify and node compatible and is therefor release in the npm
registry and can be installed using:

```
npm install --save original
```

## Usage

In all the examples we assume that the module is loaded using:

```js
'use strict';

var origin = require('original');
```

To get the origin of a given URL simply call `origin` function with any given
URL to get origin.

```js
var o = origin('https://google.com/foo/bar?path');

// o = https://google.com
```

To compare if two URL's share the same origin you can call the `same` method.

```js
if (origin.same('https://google.com/foo', 'https://primus.io')) {
  console.log('same');
} else {
  console.log('guess what, google.com and primus.io are not the same origin');
}
```

And that's it.

## License

MIT

---
_Source: https://npm.io/package/original · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
