Merge pull request #19446 from coderslagoon/file-url-update

updated definitions for file-url version 2.0.2
This commit is contained in:
Nathan Shively-Sanders
2017-09-07 10:14:10 -07:00
committed by GitHub
3 changed files with 30 additions and 7 deletions
+7 -4
View File
@@ -1,10 +1,13 @@
import fileUrl = require("file-url");
// Copied from https://github.com/sindresorhus/file-url/blob/14c7a69ae3798f50b3a4a21823c86e10b38160fe/readme.md
// from https://raw.githubusercontent.com/sindresorhus/file-url/df60ecfe08f9844569c794e92ecc2c53d1dd298d/readme.md
fileUrl('unicorn.jpg');
//=> 'file:///Users/sindresorhus/dev/file-url/unicorn.jpg'
// => 'file:///Users/sindresorhus/dev/file-url/unicorn.jpg'
fileUrl('/Users/pony/pics/unicorn.jpg');
//=> 'file:///Users/pony/pics/unicorn.jpg'
// => 'file:///Users/pony/pics/unicorn.jpg'
// passing {resolve: false} will make it not call path.resolve() on the path
fileUrl('unicorn.jpg', {resolve: false});
// => 'file:///unicorn.jpg'
+22 -3
View File
@@ -1,12 +1,31 @@
// Type definitions for file-url v1.0.1
// Type definitions for file-url 2.0
// Project: https://github.com/sindresorhus/file-url
// Definitions by: MEDIA CHECK s.r.o. <http://www.mediacheck.cz/>
// Definitions by: coderslagoon <https://github.com/coderslagoon>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/*
Original typings for 1.0 were provided by
"MEDIA CHECK s.r.o. <http://www.mediacheck.cz/>",
Did not pass the tslint check, hence mentioning it here.
*/
/**
* Options for the fileUrl() API.
*/
interface FileUrlOptions {
/**
* Passing false will make it not call path.resolve() on the path.
*/
resolve?: boolean;
}
/**
* Convert a path to a file URL.
* @param path File path to convert.
* @param options Options to use.
* @return File URL.
*/
declare function fileUrl(path:string):string;
declare function fileUrl(path: string, options?: FileUrlOptions): string;
/**
* Convert a path to a file URL.
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }