vscode-uri
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -173,2 +173,5 @@ /*--------------------------------------------------------------------------------------------- | ||
Uri.from = function (components) { | ||
if (!components) { | ||
throw new Error(); | ||
} | ||
return new Uri().with(components); | ||
@@ -283,9 +286,10 @@ }; | ||
: encodeNoop; | ||
var parts = []; | ||
var result = ''; | ||
var scheme = uri.scheme, authority = uri.authority, path = uri.path, query = uri.query, fragment = uri.fragment; | ||
if (scheme) { | ||
parts.push(scheme, ':'); | ||
result += scheme; | ||
result += ':'; | ||
} | ||
if (authority || scheme === 'file') { | ||
parts.push('//'); | ||
result += '//'; | ||
} | ||
@@ -296,6 +300,7 @@ if (authority) { | ||
if (idx === -1) { | ||
parts.push(encoder(authority)); | ||
result += encoder(authority); | ||
} | ||
else { | ||
parts.push(encoder(authority.substr(0, idx)), authority.substr(idx)); | ||
result += encoder(authority.substr(0, idx)); | ||
result += authority.substr(idx); | ||
} | ||
@@ -317,6 +322,7 @@ } | ||
if (idx === -1) { | ||
parts.push(encoder(path.substring(lastIdx)).replace(/[#?]/, _encode)); | ||
result += encoder(path.substring(lastIdx)).replace(/[#?]/, _encode); | ||
break; | ||
} | ||
parts.push(encoder(path.substring(lastIdx, idx)).replace(/[#?]/, _encode), Uri._slash); | ||
result += encoder(path.substring(lastIdx, idx)).replace(/[#?]/, _encode); | ||
result += Uri._slash; | ||
lastIdx = idx + 1; | ||
@@ -327,8 +333,10 @@ } | ||
if (query) { | ||
parts.push('?', encoder(query)); | ||
result += '?'; | ||
result += encoder(query); | ||
} | ||
if (fragment) { | ||
parts.push('#', encoder(fragment)); | ||
result += '#'; | ||
result += encoder(fragment); | ||
} | ||
return parts.join(Uri._empty); | ||
return result; | ||
}; | ||
@@ -335,0 +343,0 @@ Uri.prototype.toJSON = function () { |
{ | ||
"name": "vscode-uri", | ||
"author": "Microsoft", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "The URI implementation that is used by VS Code and its extensions", | ||
@@ -6,0 +6,0 @@ "main": "lib/index.js", |
## vscode-uri | ||
[![Build Status](https://travis-ci.org/Microsoft/vscode-uri.svg?branch=master)](https://travis-ci.org/Microsoft/vscode-uri) | ||
This module contains the URI implementation that is used by VS Code and its extensions. | ||
@@ -20,3 +22,3 @@ It has support for parsing a string into `scheme`, `authority`, `path`, `query`, and | ||
```js | ||
import Uri from ('vscode-uri') | ||
import Uri from 'vscode-uri' | ||
@@ -32,2 +34,3 @@ // parse an Uri from string | ||
assert.ok(uri.fragment === 'frag'); | ||
assert.ok(uri.toString() === 'https://code.visualstudio.com/docs/extensions/overview#frag') | ||
@@ -44,2 +47,3 @@ | ||
assert.ok(uri.fragment === ''); | ||
assert.ok(uri.toString() === 'file:///users/me/c%23-projects/') | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20148
7
481
46