mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
Merge pull request #19446 from coderslagoon/file-url-update
updated definitions for file-url version 2.0.2
This commit is contained in:
@@ -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'
|
||||
|
||||
Vendored
+22
-3
@@ -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.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user