First commit
This commit is contained in:
22
hGameTest/node_modules/original/LICENSE
generated
vendored
Normal file
22
hGameTest/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
hGameTest/node_modules/original/README.md
generated
vendored
Normal file
51
hGameTest/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
hGameTest/node_modules/original/index.js
generated
vendored
Normal file
46
hGameTest/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;
|
||||
64
hGameTest/node_modules/original/package.json
generated
vendored
Normal file
64
hGameTest/node_modules/original/package.json
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"_from": "original@>=0.0.5",
|
||||
"_id": "original@1.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-hyBVl6iqqUOJ8FqRe+l/gS8H+kKYjrEndd5Pm1MfBtsEKA038HkkdbAl/72EAXGyonD/PFsvmVG+EvcIpliMBg==",
|
||||
"_location": "/original",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "original@>=0.0.5",
|
||||
"name": "original",
|
||||
"escapedName": "original",
|
||||
"rawSpec": ">=0.0.5",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": ">=0.0.5"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/eventsource"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/original/-/original-1.0.2.tgz",
|
||||
"_shasum": "e442a61cffe1c5fd20a65f3261c26663b303f25f",
|
||||
"_spec": "original@>=0.0.5",
|
||||
"_where": "/home/andreas/Documents/Projects/haxe/openfl/nigger/node_modules/eventsource",
|
||||
"author": {
|
||||
"name": "Arnout Kazemier"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/unshiftio/original/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"url-parse": "^1.4.3"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Generate the origin from an URL or check if two URL/Origins are the same",
|
||||
"devDependencies": {
|
||||
"assume": "~2.1.0",
|
||||
"istanbul": "0.4.x",
|
||||
"mocha": "~3.5.0",
|
||||
"pre-commit": "~1.2.0"
|
||||
},
|
||||
"homepage": "https://github.com/unshiftio/original#readme",
|
||||
"keywords": [
|
||||
"origin",
|
||||
"url",
|
||||
"parse"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "original",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/unshiftio/original.git"
|
||||
},
|
||||
"scripts": {
|
||||
"100%": "istanbul check-coverage --statements 100 --functions 100 --lines 100 --branches 100",
|
||||
"coverage": "istanbul cover _mocha -- test.js",
|
||||
"test": "mocha test.js",
|
||||
"test-travis": "istanbul cover _mocha --report lcovonly -- test.js",
|
||||
"watch": "mocha --watch test.js"
|
||||
},
|
||||
"version": "1.0.2"
|
||||
}
|
||||
Reference in New Issue
Block a user