mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-06 06:19:58 +08:00
Add definition for sanitize-filename
This commit is contained in:
12
sanitize-filename/sanitize-filename-tests.ts
Normal file
12
sanitize-filename/sanitize-filename-tests.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
/// <reference path="./sanitize-filename.d.ts" />
|
||||
|
||||
import sanitize = require('sanitize-filename');
|
||||
|
||||
// Some string that may be unsafe as a filesystem filename
|
||||
var UNSAFE_FILENAME = "h*ello:/world?\u0000";
|
||||
|
||||
// Sanitize the unsafe filename to be safe for use as a filename
|
||||
var filename: string;
|
||||
|
||||
filename = sanitize(UNSAFE_FILENAME);
|
||||
filename = sanitize(UNSAFE_FILENAME, { replacement: '--' });
|
||||
16
sanitize-filename/sanitize-filename.d.ts
vendored
Normal file
16
sanitize-filename/sanitize-filename.d.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
// Type definitions for sanitize-filename v1.1.1
|
||||
// Project: https://github.com/parshap/node-sanitize-filename
|
||||
// Definitions by: Wim Looman <https://github.com/Nemo157>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "sanitize-filename" {
|
||||
function sanitize(filename: string, options?: sanitize.Options): string;
|
||||
|
||||
module sanitize {
|
||||
interface Options {
|
||||
replacement: string;
|
||||
}
|
||||
}
|
||||
|
||||
export = sanitize;
|
||||
}
|
||||
Reference in New Issue
Block a user