Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lil-uri

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lil-uri - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

2

bower.json
{
"name": "lil-uri",
"description": "Tiny URI parser and builder with chainable API",
"version": "0.1.0",
"version": "0.1.1",
"license": "MIT",

@@ -6,0 +6,0 @@ "repository": "lil-js/uri",

{
"name": "lil-uri",
"description": "Tiny URI parser and builder",
"version": "0.1.0",
"version": "0.1.1",
"license": "MIT",

@@ -6,0 +6,0 @@ "repository": "lil-js/uri",

{
"name": "lil-uri",
"description": "Tiny URI parser and builder with chainable API",
"version": "0.1.0",
"version": "0.1.1",
"license": "MIT",

@@ -25,3 +25,2 @@ "repository": "lil-js/uri",

"devDependencies": {
"browserify": "^5.9.1",
"chai": "^1.9.1",

@@ -28,0 +27,0 @@ "mocha": "^1.21.3",

@@ -1,2 +0,2 @@

# [lil](http://lil-js.github.io)'-uri [![Build Status](https://api.travis-ci.org/lil-js/uri.svg?branch=master)][travis] [![Stories in Ready](https://badge.waffle.io/lil-js/uri.png?label=ready&title=Ready)](https://waffle.io/lil-js/uri) [![Gitter chat](https://badges.gitter.im/lil-js/uri.png)](https://gitter.im/lil-js/uri)
# [lil](http://lil-js.github.io)'-uri [![Build Status](https://api.travis-ci.org/lil-js/uri.svg?branch=master)][travis] [![Stories in Ready](https://badge.waffle.io/lil-js/uri.png?label=ready&title=Ready)](https://waffle.io/lil-js/uri) [![Code Climate](https://codeclimate.com/github/lil-js/uri/badges/gpa.svg)](https://codeclimate.com/github/lil-js/uri) [![Gitter chat](https://badges.gitter.im/lil-js/uri.png)](https://gitter.im/lil-js/uri)

@@ -12,3 +12,3 @@ <img align="center" height="150" src="http://lil-js.github.io/img/liljs-logo.png" />

<tr>
<td><b>Version</b></td><td>0.1.0</td>
<td><b>Version</b></td><td>0.1.1</td>
</tr>

@@ -50,3 +50,3 @@ <tr>

```html
<script src="//cdn.rawgit.com/lil-js/uri/0.1.0/uri.js"></script>
<script src="//cdn.rawgit.com/lil-js/uri/0.1.1/uri.js"></script>
```

@@ -75,3 +75,3 @@

```js
var url = uri('http://user:pass@example.com:8080/bar/foo.xml?foo=bar&hello=world&#frament=1')
var url = uri('http://user:pass@example.com:8080/bar/foo.xml?foo=bar&hello=world&#hash=1')
url.protocol() // -> http

@@ -87,3 +87,3 @@ url.host() // -> example.com:8080

url.query() // -> { foo: 'bar', hello: 'world' }
url.frament() // -> fragment=1
url.hash() // -> hash=1
```

@@ -100,3 +100,3 @@

.query({ foo: 'bar', hello: 'world' })
.fragment('fragment=1')
.hash('hash=1')
.build() // -> http://@example.com:8080/bar/foo.xml?foo=bar&hello=world&#frament=1

@@ -129,3 +129,3 @@ ```

#### uri#fragment([ fragment ])
#### uri#hash([ fragment ])

@@ -136,2 +136,6 @@ #### uri#build()

#### uri.isURL(str)
#### uri.is(url)
#### uri.VERSION

@@ -138,0 +142,0 @@

@@ -16,2 +16,12 @@ var uri = require('../uri')

describe('isURL', function () {
it('should be a valid URL schema', function () {
expect(uri.isURL('http://test.org/me')).to.be.true
})
it('should not be a valid URL', function () {
expect(uri.isURL(null)).to.be.false
})
})
describe('parser', function () {

@@ -92,3 +102,3 @@ describe('protocol + host', function () {

describe('host + path + search + fragment', function () {
describe('host + path + search + hash', function () {
var url = 'http://www.google.com/some-awesome?name=John&surname=Norris#type=actor'

@@ -112,4 +122,4 @@

it('should match the fragment', function () {
expect(uri(url).fragment()).to.be.equal('type=actor')
it('should match the hash', function () {
expect(uri(url).hash()).to.be.equal('type=actor')
})

@@ -146,8 +156,8 @@ })

it('should extract the fragment params', function () {
expect(uri('#name=John&age=30').fragment()).to.be.equal('name=John&age=30')
it('should extract the hash params', function () {
expect(uri('#name=John&age=30').hash()).to.be.equal('name=John&age=30')
})
it('should extract the fragment params and search params', function () {
expect(uri('?query=value#name=John&age=30').fragment()).to.be.equal('name=John&age=30')
it('should extract the hash params and search params', function () {
expect(uri('?query=value#name=John&age=30').hash()).to.be.equal('name=John&age=30')
})

@@ -284,3 +294,3 @@ })

describe('host + path + search + fragment', function () {
describe('host + path + search + hash', function () {
before(function () {

@@ -306,4 +316,4 @@ url = uri()

it('should build the fragment', function () {
expect(url.fragment('type=actor').fragment()).to.be.equal('type=actor')
it('should build the hash', function () {
expect(url.hash('type=actor').hash()).to.be.equal('type=actor')
})

@@ -310,0 +320,0 @@

@@ -14,3 +14,4 @@ /*! lil-uri - v0.1 - MIT License - https://github.com/lil-js/uri */

}(this, function (exports) {
var VERSION = '0.1.0'
'use strict'
var VERSION = '0.1.1'
var REGEX = /^(?:([^:\/?#]+):\/\/)?((?:([^\/?#@]*)@)?([^\/?#:]*)(?:\:(\d*))?)?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n)*))?/i

@@ -76,3 +77,3 @@

query: mapSearchParams(parts[7]),
fragment: parts[8]
hash: parts[8]
}

@@ -122,4 +123,4 @@ }

URI.prototype.fragment = function (fragment) {
return accessor('fragment').call(this, fragment)
URI.prototype.hash = function (hash) {
return accessor('hash').call(this, hash)
}

@@ -160,5 +161,5 @@

if (p.fragment) {
if (p.hash) {
if (!p.path) buf.push('/')
buf.push('#' + p.fragment)
buf.push('#' + p.hash)
}

@@ -173,4 +174,10 @@

function isURL(uri) {
return typeof uri === 'string' && REGEX.test(uri)
}
uri.VERSION = VERSION
uri.is = uri.isURL = isURL
exports.uri = uri
}))
/*! lil-uri - v0.1 - MIT License - https://github.com/lil-js/uri */
(function(t,r){if(typeof define==="function"&&define.amd){define(["exports"],r)}else if(typeof exports==="object"){r(exports);if(typeof module==="object"&&module!==null){module.exports=exports=exports.uri}}else{r(t.lil=t.lil||{})}})(this,function(t){var r="0.1.0";var e=/^(?:([^:\/?#]+):\/\/)?((?:([^\/?#@]*)@)?([^\/?#:]*)(?:\:(\d*))?)?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n)*))?/i;function o(t){return typeof t==="string"}function n(t){var r={};if(t){t.split("&").forEach(function(t){if(t){t=t.split("=");if(r.hasOwnProperty(t[0])){r[t[0]]=Array.isArray(r[t[0]])?r[t[0]]:[r[t[0]]];r[t[0]].push(t[1])}else{r[t[0]]=t[1]}}});return r}}function s(t){return function(r){if(r){this.parts[t]=o(r)?decodeURIComponent(r):r;return this}this.parts=this.parse(this.build());return this.parts[t]}}function p(t){this.uri=t||null;if(o(t)&&t.length){this.parts=this.parse(t)}else{this.parts={}}}p.prototype.parse=function(t){var r=decodeURIComponent(t||"").match(e);var o=(r[3]||"").split(":");var s=o.length?(r[2]||"").replace(/(.*\@)/,""):r[2];return{uri:r[0],protocol:r[1],host:s,hostname:r[4],port:r[5],auth:r[3],user:o[0],password:o[1],path:r[6],search:r[7],query:n(r[7]),fragment:r[8]}};p.prototype.protocol=function(t){return s("protocol").call(this,t)};p.prototype.host=function(t){return s("host").call(this,t)};p.prototype.hostname=function(t){return s("hostname").call(this,t)};p.prototype.port=function(t){return s("port").call(this,t)};p.prototype.auth=function(t){return s("host").call(this,t)};p.prototype.user=function(t){return s("user").call(this,t)};p.prototype.password=function(t){return s("password").call(this,t)};p.prototype.path=function(t){return s("path").call(this,t)};p.prototype.search=function(t){return s("search").call(this,t)};p.prototype.query=function(t){return t&&typeof t==="object"?s("query").call(this,t):this.parts.query};p.prototype.fragment=function(t){return s("fragment").call(this,t)};p.prototype.get=function(t){return this.parts[t]||""};p.prototype.build=p.prototype.toString=p.prototype.valueOf=function(){var t=this.parts,r=[];if(t.protocol)r.push(t.protocol+"://");if(t.auth)r.push(t.auth+"@");else if(t.user)r.push(t.user+(t.password?":"+t.password:"")+"@");if(t.host)r.push(t.host);else{if(t.hostname)r.push(t.hostname);if(t.port)r.push(":"+t.port)}if(t.path)r.push(t.path);if(t.query&&typeof t.query==="object"){if(!t.path)r.push("/");r.push("?"+Object.keys(t.query).map(function(r){if(Array.isArray(t.query[r])){return t.query[r].map(function(t){return r+(t?"="+t:"")}).join("&")}else{return r+(t.query[r]?"="+t.query[r]:"")}}).join("&"))}else if(t.search){r.push("?"+t.search)}if(t.fragment){if(!t.path)r.push("/");r.push("#"+t.fragment)}return this.url=r.filter(function(t){return o(t)}).join("")};function i(t){return new p(t)}i.VERSION=r;t.uri=i});
(function(t,r){if(typeof define==="function"&&define.amd){define(["exports"],r)}else if(typeof exports==="object"){r(exports);if(typeof module==="object"&&module!==null){module.exports=exports=exports.uri}}else{r(t.lil=t.lil||{})}})(this,function(t){"use strict";var r="0.1.1";var e=/^(?:([^:\/?#]+):\/\/)?((?:([^\/?#@]*)@)?([^\/?#:]*)(?:\:(\d*))?)?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n)*))?/i;function o(t){return typeof t==="string"}function s(t){var r={};if(t){t.split("&").forEach(function(t){if(t){t=t.split("=");if(r.hasOwnProperty(t[0])){r[t[0]]=Array.isArray(r[t[0]])?r[t[0]]:[r[t[0]]];r[t[0]].push(t[1])}else{r[t[0]]=t[1]}}});return r}}function n(t){return function(r){if(r){this.parts[t]=o(r)?decodeURIComponent(r):r;return this}this.parts=this.parse(this.build());return this.parts[t]}}function i(t){this.uri=t||null;if(o(t)&&t.length){this.parts=this.parse(t)}else{this.parts={}}}i.prototype.parse=function(t){var r=decodeURIComponent(t||"").match(e);var o=(r[3]||"").split(":");var n=o.length?(r[2]||"").replace(/(.*\@)/,""):r[2];return{uri:r[0],protocol:r[1],host:n,hostname:r[4],port:r[5],auth:r[3],user:o[0],password:o[1],path:r[6],search:r[7],query:s(r[7]),hash:r[8]}};i.prototype.protocol=function(t){return n("protocol").call(this,t)};i.prototype.host=function(t){return n("host").call(this,t)};i.prototype.hostname=function(t){return n("hostname").call(this,t)};i.prototype.port=function(t){return n("port").call(this,t)};i.prototype.auth=function(t){return n("host").call(this,t)};i.prototype.user=function(t){return n("user").call(this,t)};i.prototype.password=function(t){return n("password").call(this,t)};i.prototype.path=function(t){return n("path").call(this,t)};i.prototype.search=function(t){return n("search").call(this,t)};i.prototype.query=function(t){return t&&typeof t==="object"?n("query").call(this,t):this.parts.query};i.prototype.hash=function(t){return n("hash").call(this,t)};i.prototype.get=function(t){return this.parts[t]||""};i.prototype.build=i.prototype.toString=i.prototype.valueOf=function(){var t=this.parts,r=[];if(t.protocol)r.push(t.protocol+"://");if(t.auth)r.push(t.auth+"@");else if(t.user)r.push(t.user+(t.password?":"+t.password:"")+"@");if(t.host)r.push(t.host);else{if(t.hostname)r.push(t.hostname);if(t.port)r.push(":"+t.port)}if(t.path)r.push(t.path);if(t.query&&typeof t.query==="object"){if(!t.path)r.push("/");r.push("?"+Object.keys(t.query).map(function(r){if(Array.isArray(t.query[r])){return t.query[r].map(function(t){return r+(t?"="+t:"")}).join("&")}else{return r+(t.query[r]?"="+t.query[r]:"")}}).join("&"))}else if(t.search){r.push("?"+t.search)}if(t.hash){if(!t.path)r.push("/");r.push("#"+t.hash)}return this.url=r.filter(function(t){return o(t)}).join("")};function p(t){return new i(t)}function u(t){return typeof t==="string"&&e.test(t)}p.VERSION=r;p.is=p.isURL=u;t.uri=p});
//# sourceMappingURL=uri.min.js.map

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc