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

iri

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iri - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

.editorconfig

31

index.js

@@ -59,12 +59,12 @@ var api = exports;

IRI.prototype.isAbsolute = function isAbsolute() {
return this.scheme()!=null && this.heirpart()!=null && this.fragment()==null;
return this.scheme()!=null && this.hierpart()!=null && this.fragment()==null;
}
IRI.prototype.toAbsolute = function toAbsolute() {
if(this.scheme() == null && this.heirpart() == null) { throw new Error("IRI must have a scheme and a heirpart!"); }
if(this.scheme() == null || this.hierpart() == null) { throw new Error("IRI must have a scheme and a hierpart!"); }
return this.resolveReference(this.value).defrag();
}
IRI.prototype.authority = function authority() {
var heirpart = this.heirpart();
if(heirpart.substring(0, 2) != "//") return null;
var authority = heirpart.slice(2);
var hierpart = this.hierpart();
if(hierpart.substring(0, 2) != "//") return null;
var authority = hierpart.slice(2);
var q = authority.indexOf("/");

@@ -77,15 +77,16 @@ return q>=0 ? authority.substring(0, q) : authority;

}
IRI.prototype.heirpart = function heirpart() {
var heirpart = this.value;
var q = heirpart.indexOf("?");
IRI.prototype.hierpart = function hierpart() {
var hierpart = this.value;
var q = hierpart.indexOf("?");
if(q >= 0) {
heirpart = heirpart.substring(0, q);
hierpart = hierpart.substring(0, q);
} else {
q = heirpart.indexOf("#");
if(q >= 0) heirpart = heirpart.substring(0, q);
q = hierpart.indexOf("#");
if(q >= 0) hierpart = hierpart.substring(0, q);
}
var q2 = this.scheme();
if(q2 != null) heirpart = heirpart.slice(1 + q2.length);
return heirpart;
if(q2 != null) hierpart = hierpart.slice(1 + q2.length);
return hierpart;
}
IRI.prototype.heirpart = IRI.prototype.hierpart;
IRI.prototype.host = function host() {

@@ -104,4 +105,4 @@ var host = this.authority();

var q = this.authority();
if(q == null) return this.heirpart();
return this.heirpart().slice(q.length + 2);
if(q == null) return this.hierpart();
return this.hierpart().slice(q.length + 2);
}

@@ -108,0 +109,0 @@ IRI.prototype.port = function port() {

@@ -1,19 +0,23 @@

{ "name": "iri"
, "description": "IRI/URI parsing and conversion"
, "homepage": "https://github.com/Acubed/node-iri"
, "version": "1.1.1"
, "author": "Austin Wright"
, "keywords": ["IRI", "URI", "URL"]
, "repository":
{ "type": "git"
, "url": "git://github.com/Acubed/node-iri.git"
, "web": "https://github.com/Acubed/node-iri"
{
"name": "iri",
"version": "1.2.0",
"description": "IRI parsing and IRI-URI conversion utilities",
"homepage": "https://github.com/awwright/node-iri",
"author": "Austin Wright",
"keywords": [
"IRI"
],
"repository": {
"type": "git",
"url": "git://github.com/awwright/node-iri.git",
"web": "https://github.com/awwright/node-iri"
},
"main": "inde.js",
"scripts": {
"test": "vows"
},
"license": "Unlicense",
"devDependencies": {
"vows": "^0.8.1"
}
, "main": "index.js"
, "scripts": { "test" : "vows" }
, "licenses": [
{ "type": "Public domain"
, "url": "http://unlicense.org/"
}
]
}

@@ -24,3 +24,3 @@ var vows=require('vows');

, ".fragment() is null": function(t){ assert.isNull(t.fragment()); }
, ".heirpart() === '//example.com/'": function(t){ assert.strictEqual(t.heirpart(), '//example.com/'); }
, ".hierpart() === '//example.com/'": function(t){ assert.strictEqual(t.hierpart(), '//example.com/'); }
, ".host() === 'example.com'": function(t){ assert.strictEqual(t.host(), 'example.com'); }

@@ -49,3 +49,3 @@ , ".path() === '/'": function(t){ assert.strictEqual(t.path(), '/'); }

, ".fragment()": function(t){ assert.strictEqual(t.fragment(), '#455'); }
, ".heirpart()": function(t){ assert.strictEqual(t.heirpart(), '//user:pass@a.example.com:8080/b/c/d/'); }
, ".hierpart()": function(t){ assert.strictEqual(t.hierpart(), '//user:pass@a.example.com:8080/b/c/d/'); }
, ".host() === 'a.example.com'": function(t){ assert.strictEqual(t.host(), 'a.example.com'); }

@@ -52,0 +52,0 @@ , ".path() === '/b/c/d/?123&aa=1&aa=2'": function(t){ assert.strictEqual(t.path(), '/b/c/d/'); }

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