mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
added definitions for jsesc
This commit is contained in:
parent
851a305add
commit
6527fc4a3d
45
jsesc/jsesc-tests.ts
Normal file
45
jsesc/jsesc-tests.ts
Normal file
@ -0,0 +1,45 @@
|
||||
/// <reference path="jsesc.d.ts" />
|
||||
|
||||
import jsesc = require('jsesc');
|
||||
import Opts = jsesc.Opts;
|
||||
|
||||
// ---- ---- ---- ---- ---- ---- ----
|
||||
|
||||
var num: number;
|
||||
var str: string;
|
||||
var bool: boolean;
|
||||
var opts: Opts;
|
||||
var opts: Opts;
|
||||
|
||||
// ---- ---- ---- ---- ---- ---- ----
|
||||
|
||||
str = jsesc.version;
|
||||
|
||||
// ---- ---- ---- ---- ---- ---- ----
|
||||
|
||||
opts = {
|
||||
quotes: str
|
||||
};
|
||||
opts = {
|
||||
wrap: bool
|
||||
};
|
||||
opts = {
|
||||
es6: bool
|
||||
};
|
||||
opts = {
|
||||
escapeEverything: bool
|
||||
};
|
||||
opts = {
|
||||
compact: bool
|
||||
};
|
||||
opts = {
|
||||
indent: str
|
||||
};
|
||||
opts = {
|
||||
json: bool
|
||||
};
|
||||
|
||||
// ---- ---- ---- ---- ---- ---- ----
|
||||
|
||||
str = jsesc(str);
|
||||
str = jsesc(str, opts);
|
||||
25
jsesc/jsesc.d.ts
vendored
Normal file
25
jsesc/jsesc.d.ts
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
// Type definitions for jsesc 0.4.3
|
||||
// Project: https://github.com/mathiasbynens/jsesc
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module 'jsesc' {
|
||||
|
||||
function jsesc(str: string, opts?: any): string;
|
||||
|
||||
module jsesc {
|
||||
var version: string;
|
||||
|
||||
interface Opts {
|
||||
quotes?: string;
|
||||
wrap?: boolean;
|
||||
es6?: boolean;
|
||||
escapeEverything?: boolean;
|
||||
compact?: boolean;
|
||||
indent?: string;
|
||||
json?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export = jsesc;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user