mini-url
Advanced tools
Comparing version 2.0.3 to 2.1.0
@@ -0,16 +1,7 @@ | ||
import * as T from "./_types"; | ||
import parts from "./url/parts"; | ||
declare const cache: { | ||
[x: string]: InterfaceURLInstance; | ||
[x: string]: T.URL; | ||
}; | ||
export interface InterfaceURLInstance { | ||
protocol?: string; | ||
host?: string; | ||
hostname?: string; | ||
port?: string; | ||
pathname?: string; | ||
search?: string; | ||
hash?: string; | ||
href?: string; | ||
toString(): string; | ||
} | ||
export { T as Types }; | ||
export { parts, cache }; | ||
@@ -21,6 +12,6 @@ /** | ||
*/ | ||
export declare function parse(path: string, base?: string): InterfaceURLInstance; | ||
export declare function parse(path: string, base?: string): T.URL; | ||
/** | ||
* Converts a URL like object into an href. | ||
*/ | ||
export declare function stringify(parsed: InterfaceURLInstance): string; | ||
export declare function stringify(parsed: T.URL): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var T = require("./_types"); | ||
exports.Types = T; | ||
var url_1 = require("./url"); | ||
@@ -33,3 +35,3 @@ var parts_1 = require("./url/parts"); | ||
// Freeze object to maintain cache. | ||
return cache[key] = Object.freeze(result); | ||
return (cache[key] = Object.freeze(result)); | ||
} | ||
@@ -45,3 +47,4 @@ exports.parse = parse; | ||
return ((parsed.protocol ? parsed.protocol + "//" : "") + | ||
(parsed.host || (parsed.hostname || "") + (parsed.port ? ":" + parsed.port : "")) + | ||
(parsed.host || | ||
(parsed.hostname || "") + (parsed.port ? ":" + parsed.port : "")) + | ||
(parsed.pathname || "") + | ||
@@ -48,0 +51,0 @@ (parsed.search || "") + |
@@ -14,4 +14,4 @@ "use strict"; | ||
"hash", | ||
"href", | ||
"href" | ||
]; | ||
//# sourceMappingURL=parts.js.map |
{ | ||
"name": "mini-url", | ||
"description": "Lightweight isomorphic url parser.", | ||
"version": "2.0.3", | ||
"version": "2.1.0", | ||
"author": "Dylan Piercey <pierceydylan@gmail.com>", | ||
@@ -16,7 +16,11 @@ "browser": { | ||
"@types/mocha": "^2.2.43", | ||
"husky": "^0.14.3", | ||
"jsdom": "^11.3.0", | ||
"jsdom-global": "^3.0.2", | ||
"lint-staged": "^4.2.3", | ||
"mocha": "^4.0.1", | ||
"prettier": "^1.7.4", | ||
"ts-node": "^3.3.0", | ||
"tslint": "^5.7.0", | ||
"tslint-config-prettier": "^1.5.0", | ||
"typescript": "^2.5.3" | ||
@@ -37,2 +41,9 @@ }, | ||
"license": "MIT", | ||
"lint-staged": { | ||
"*.ts": [ | ||
"prettier --write", | ||
"tslint -t codeFrame -c tslint.json", | ||
"git add" | ||
] | ||
}, | ||
"main": "dist/index.js", | ||
@@ -44,8 +55,7 @@ "repository": { | ||
"scripts": { | ||
"build": "npm run lint && tsc", | ||
"lint": "tslint -t codeFrame -c tslint.json '{src,test}/**/*.ts'", | ||
"prepublish": "npm test", | ||
"test": "npm run build && mocha -r ts-node/register ./test/**/*.test.ts" | ||
"format-all": "find ./{src,test}/**/*.ts | xargs prettier --write", | ||
"precommit": "lint-staged && npm test", | ||
"test": "tsc && mocha -r ts-node/register ./test/**/*.test.ts" | ||
}, | ||
"types": "dist/index.d.ts" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
15105
17
233
11