mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 13:42:20 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
22
web/node_modules/original/LICENSE
generated
vendored
Normal file
22
web/node_modules/original/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Unshift.io, Arnout Kazemier, the Contributors.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
51
web/node_modules/original/README.md
generated
vendored
Normal file
51
web/node_modules/original/README.md
generated
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
# origin(al)
|
||||
|
||||
[](http://unshift.io)[](http://browsenpm.org/package/original)[](https://travis-ci.org/unshiftio/original)[](https://david-dm.org/unshiftio/original)[](https://coveralls.io/r/unshiftio/original?branch=master)[](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
|
46
web/node_modules/original/index.js
generated
vendored
Normal file
46
web/node_modules/original/index.js
generated
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
'use strict';
|
||||
|
||||
var parse = require('url-parse');
|
||||
|
||||
/**
|
||||
* Transform an URL to a valid origin value.
|
||||
*
|
||||
* @param {String|Object} url URL to transform to it's origin.
|
||||
* @returns {String} The origin.
|
||||
* @api public
|
||||
*/
|
||||
function origin(url) {
|
||||
if ('string' === typeof url) url = parse(url);
|
||||
|
||||
//
|
||||
// 6.2. ASCII Serialization of an Origin
|
||||
// http://tools.ietf.org/html/rfc6454#section-6.2
|
||||
//
|
||||
if (!url.protocol || !url.hostname) return 'null';
|
||||
|
||||
//
|
||||
// 4. Origin of a URI
|
||||
// http://tools.ietf.org/html/rfc6454#section-4
|
||||
//
|
||||
// States that url.scheme, host should be converted to lower case. This also
|
||||
// makes it easier to match origins as everything is just lower case.
|
||||
//
|
||||
return (url.protocol +'//'+ url.host).toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the origins are the same.
|
||||
*
|
||||
* @param {String} a URL or origin of a.
|
||||
* @param {String} b URL or origin of b.
|
||||
* @returns {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
origin.same = function same(a, b) {
|
||||
return origin(a) === origin(b);
|
||||
};
|
||||
|
||||
//
|
||||
// Expose the origin
|
||||
//
|
||||
module.exports = origin;
|
33
web/node_modules/original/package.json
generated
vendored
Normal file
33
web/node_modules/original/package.json
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"name": "original",
|
||||
"version": "1.0.2",
|
||||
"description": "Generate the origin from an URL or check if two URL/Origins are the same",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"100%": "istanbul check-coverage --statements 100 --functions 100 --lines 100 --branches 100",
|
||||
"test-travis": "istanbul cover _mocha --report lcovonly -- test.js",
|
||||
"coverage": "istanbul cover _mocha -- test.js",
|
||||
"watch": "mocha --watch test.js",
|
||||
"test": "mocha test.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/unshiftio/original"
|
||||
},
|
||||
"keywords": [
|
||||
"origin",
|
||||
"url",
|
||||
"parse"
|
||||
],
|
||||
"author": "Arnout Kazemier",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"url-parse": "^1.4.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"assume": "~2.1.0",
|
||||
"istanbul": "0.4.x",
|
||||
"mocha": "~3.5.0",
|
||||
"pre-commit": "~1.2.0"
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue