Apply new lint rules to ever more packages (#15551)

This commit is contained in:
Andy
2017-03-31 12:19:34 -07:00
committed by GitHub
parent 7f28561c72
commit e69b58e400
68 changed files with 7933 additions and 7883 deletions
+1
View File
@@ -3,6 +3,7 @@
"rules": {
// Heavy use of Function type in this older package.
"ban-types": false,
"jsdoc-format": false,
"no-misused-new": false,
// not sure what this means
"no-single-declare-module": false
+9 -9
View File
@@ -5,15 +5,15 @@
export as namespace emojione;
export var sprites: boolean;
export var imagePathPNG: string;
export var imagePathSVG: string;
export var imagePathSVGSprites: string;
export var imageType: 'png' | 'svg';
export var unicodeAlt: boolean;
export var ascii: boolean;
export var unicodeRegexp: string;
export var cacheBustParam: string;
export let sprites: boolean;
export let imagePathPNG: string;
export let imagePathSVG: string;
export let imagePathSVGSprites: string;
export let imageType: 'png' | 'svg';
export let unicodeAlt: boolean;
export let ascii: boolean;
export let unicodeRegexp: string;
export let cacheBustParam: string;
export function toShort(str: string): string;
export function toImage(str: string): string;
export function shortnameToImage(str: string): string;
+3 -3
View File
@@ -2,11 +2,11 @@ import WeakMap = require('es6-weak-map');
new WeakMap<{}, string>();
var tuples: Array<[number, string]> = [ [0, 'foo'], [1, 'bar'] ];
const tuples: Array<[number, string]> = [ [0, 'foo'], [1, 'bar'] ];
new WeakMap<number, string>(tuples);
var map = new WeakMap<{}, string>();
var obj = {};
const map = new WeakMap<{}, string>();
const obj = {};
map.set(obj, 'foo');
map.get(obj);
-1
View File
@@ -30,7 +30,6 @@ declare namespace MySQLStore {
}
declare class MySQLStore {
/**
* @param {MySQLStore.Options} options
* @param {any} connection?
@@ -17,8 +17,8 @@ const createAccountLimiter = new RateLimit({
class SomeStore implements RateLimit.Store {
incr(key: string, cb: RateLimit.StoreIncrementCallback) { }
resetAll() { }
resetKey(key: string) { };
};
resetKey(key: string) { }
}
const limiterWithStore = new RateLimit({
store: new SomeStore()
+6 -6
View File
@@ -9,20 +9,20 @@ declare namespace RateLimit {
type StoreIncrementCallback = (err?: {}, hits?: number) => void;
interface Store {
incr: (key: string, cb: StoreIncrementCallback) => void;
resetAll: () => void;
resetKey: (key: string) => void;
incr(key: string, cb: StoreIncrementCallback): void;
resetAll(): void;
resetKey(key: string): void;
}
interface Options {
delayAfter?: number;
delayMs?: number;
handlers?: () => any;
handlers?(): any;
headers?: boolean;
keyGenerator?: () => string;
keyGenerator?(): string;
max?: number;
message?: string;
skip?: () => boolean;
skip?(): boolean;
statusCode?: number;
store?: Store;
windowMs?: number;
+1 -1
View File
@@ -8,7 +8,7 @@ declare namespace extract {
dir?: string;
defaultDirMode?: number;
defaultFileMode?: number;
onEntry?: (entry: any, zipfile: any) => void;
onEntry?(entry: any, zipfile: any): void;
}
}
+43 -41
View File
@@ -33,8 +33,10 @@ function sample1() {
}
function sample2() {
let dot: fabric.Circle, i: number;
let t1: number, t2: number;
let dot: fabric.Circle;
let i: number;
let t1: number;
let t2: number;
const startTimer = () => {
t1 = new Date().getTime();
return t1;
@@ -42,16 +44,16 @@ function sample2() {
const stopTimer = () => {
t2 = new Date().getTime();
return t2 - t1;
},
getRandomInt = fabric.util.getRandomInt,
rainbow = ["#ffcc66", "#ccff66", "#66ccff", "#ff6fcf", "#ff6666"],
rainbowEnd = rainbow.length - 1;
};
const getRandomInt = fabric.util.getRandomInt;
const rainbow = ["#ffcc66", "#ccff66", "#66ccff", "#ff6fcf", "#ff6666"];
const rainbowEnd = rainbow.length - 1;
//
// Rendering canvas #1
//
const canvas1 = new fabric.Canvas('c1', { backgroundColor: "#000" }),
results1 = document.getElementById('results-c1');
const canvas1 = new fabric.Canvas('c1', { backgroundColor: "#000" });
const results1 = document.getElementById('results-c1');
startTimer();
for (i = 100; i >= 0; i--) {
@@ -68,8 +70,8 @@ function sample2() {
//
// Rendering canvas #2
//
const canvas2 = new fabric.Canvas('c2', { backgroundColor: "#000", renderOnAddRemove: false }),
results2 = document.getElementById('results-c2');
const canvas2 = new fabric.Canvas('c2', { backgroundColor: "#000", renderOnAddRemove: false });
const results2 = document.getElementById('results-c2');
startTimer();
for (i = 1000; i >= 0; i--) {
@@ -101,8 +103,8 @@ function sample3() {
}
}
const canvas = new fabric.Canvas('c', { backgroundImage: '../lib/bg.png' }),
f = fabric.Image.filters;
const canvas = new fabric.Canvas('c', { backgroundImage: '../lib/bg.png' });
const f = fabric.Image.filters;
canvas.on({
'object:selected': () => {
@@ -296,12 +298,12 @@ function sample5() {
const canvas = new fabric.Canvas('c', { selection: false });
const line = makeLine([250, 125, 250, 175]),
line2 = makeLine([250, 175, 250, 250]),
line3 = makeLine([250, 250, 300, 350]),
line4 = makeLine([250, 250, 200, 350]),
line5 = makeLine([250, 175, 175, 225]),
line6 = makeLine([250, 175, 325, 225]);
const line = makeLine([250, 125, 250, 175]);
const line2 = makeLine([250, 175, 250, 250]);
const line3 = makeLine([250, 250, 300, 350]);
const line4 = makeLine([250, 250, 200, 350]);
const line5 = makeLine([250, 175, 175, 225]);
const line6 = makeLine([250, 175, 325, 225]);
canvas.add(line, line2, line3, line4, line5, line6);
@@ -341,9 +343,9 @@ function sample6() {
const p = canvas.getPointer(options.e);
canvas.forEachObject(obj => {
const distX = Math.abs(p.x - obj.left),
distY = Math.abs(p.y - obj.top),
dist = Math.round(Math.sqrt(Math.pow(distX, 2) + Math.pow(distY, 2)));
const distX = Math.abs(p.x - obj.left);
const distY = Math.abs(p.y - obj.top);
const dist = Math.round(Math.sqrt(Math.pow(distX, 2) + Math.pow(distY, 2)));
obj.setOpacity(1 / (dist / 20));
});
});
@@ -436,13 +438,13 @@ function sample8() {
element = element.parentNode;
}
const className = element.className,
offset = 50,
left = fabric.util.getRandomInt(0 + offset, 700 - offset),
top = fabric.util.getRandomInt(0 + offset, 500 - offset),
angle = fabric.util.getRandomInt(-20, 40),
width = fabric.util.getRandomInt(30, 50),
opacity = ((min: number, max: number) => Math.random() * (max - min) + min)(0.5, 1);
const className = element.className;
const offset = 50;
const left = fabric.util.getRandomInt(0 + offset, 700 - offset);
const top = fabric.util.getRandomInt(0 + offset, 500 - offset);
const angle = fabric.util.getRandomInt(-20, 40);
const width = fabric.util.getRandomInt(30, 50);
const opacity = ((min: number, max: number) => Math.random() * (max - min) + min)(0.5, 1);
switch (className) {
case 'rect':
@@ -508,7 +510,7 @@ function sample8() {
case 'shape':
const id: any = element.id;
const match = /\d+$/.exec(id);
const match = /\d+$/.exec(id);
if (match) {
fabric.loadSVGFromURL('../assets/' + match[0] + '.svg', (objects, options) => {
const loadedObject = fabric.util.groupSVGElements(objects, options);
@@ -556,8 +558,8 @@ function sample8() {
const removeSelectedEl = document.getElementById('remove-selected');
removeSelectedEl.onclick = () => {
const activeObject = canvas.getActiveObject(),
activeGroup = canvas.getActiveGroup();
const activeObject = canvas.getActiveObject();
const activeGroup = canvas.getActiveGroup();
if (activeObject) {
canvas.remove(activeObject);
} else if (activeGroup) {
@@ -579,8 +581,8 @@ function sample8() {
};
};
const supportsSlider = supportsInputOfType('range'),
supportsColorpicker = supportsInputOfType('color');
const supportsSlider = supportsInputOfType('range');
const supportsColorpicker = supportsInputOfType('color');
if (supportsSlider()) {
(() => {
@@ -603,8 +605,8 @@ function sample8() {
canvas.calcOffset();
slider.onchange = function() {
const activeObject = canvas.getActiveObject(),
activeGroup = canvas.getActiveGroup();
const activeObject = canvas.getActiveObject();
const activeGroup = canvas.getActiveGroup();
if (activeObject || activeGroup) {
(activeObject || activeGroup).setOpacity(parseInt(this.value, 10) / 100);
@@ -634,8 +636,8 @@ function sample8() {
canvas.calcOffset();
colorpicker.onchange = function() {
const activeObject = canvas.getActiveObject(),
activeGroup = canvas.getActiveGroup();
const activeObject = canvas.getActiveObject();
const activeGroup = canvas.getActiveGroup();
if (activeObject || activeGroup) {
(activeObject || activeGroup).setFill(this.value);
@@ -748,10 +750,10 @@ function sample8() {
}
});
const drawingModeEl = document.getElementById('drawing-mode'),
drawingOptionsEl = document.getElementById('drawing-mode-options'),
drawingColorEl = <HTMLInputElement> document.getElementById('drawing-color'),
drawingLineWidthEl = <HTMLInputElement> document.getElementById('drawing-line-width');
const drawingModeEl = document.getElementById('drawing-mode');
const drawingOptionsEl = document.getElementById('drawing-mode-options');
const drawingColorEl = <HTMLInputElement> document.getElementById('drawing-color');
const drawingLineWidthEl = <HTMLInputElement> document.getElementById('drawing-line-width');
drawingModeEl.onclick = () => {
const canvasWithDrawingMode: any = canvas;
+7 -7
View File
@@ -1028,7 +1028,7 @@ export class StaticCanvas {
* @param {Number|String} value Value to set width to
* @param {Object} [options] Options object
*/
setWidth(value: number|string, options?: ICanvasDimensionsOptions): StaticCanvas
setWidth(value: number|string, options?: ICanvasDimensionsOptions): StaticCanvas;
/**
* Sets height of this canvas instance
@@ -1281,13 +1281,13 @@ export class StaticCanvas {
* Straightens object, then rerenders canvas
* @param {fabric.Object} object Object to straighten
*/
straightenObject(object: Object): StaticCanvas
straightenObject(object: Object): StaticCanvas;
/**
* Same as straightenObject, but animated
* @param {fabric.Object} object Object to straighten
*/
fxStraightenObject(object: Object): StaticCanvas
fxStraightenObject(object: Object): StaticCanvas;
static EMPTY_JSON: string;
/**
@@ -1512,7 +1512,7 @@ export class Canvas {
/**
* Removes all event listeners
*/
removeListeners(): void
removeListeners(): void;
static EMPTY_JSON: string;
/**
@@ -2344,7 +2344,7 @@ export class Object {
* @param {Object|Function} value Property value (if function, the value is passed into it and its return value is used as a new one)
*/
set(key: string, value: any|Function): Object;
/**
/**
* Sets property to a given value.
* When changing position/dimension -related properties (left, top, scale, angle, etc.) `set` does not update position of object's borders/controls.
* If you need to update those, call `setCoords()`.
@@ -3966,7 +3966,7 @@ export class CircleBrush extends BaseBrush {
* @param {Object} pointer
* @return {fabric.Point} Just added pointer point
*/
addPoint(pointer: any): Point
addPoint(pointer: any): Point;
}
export class SprayBrush extends BaseBrush {
@@ -3999,7 +3999,7 @@ export class SprayBrush extends BaseBrush {
/**
* @param {Object} pointer
*/
addSprayChunk(pointer: any): void
addSprayChunk(pointer: any): void;
}
export class PatternBrush extends PencilBrush {
getPatternSrc(): HTMLCanvasElement;
+12 -16
View File
@@ -3,22 +3,20 @@ import * as fetchJsonp from 'fetch-jsonp';
/* Taken from https://github.com/camsong/fetch-jsonp/blob/v1.0.2/README.md */
fetchJsonp('/users.jsonp')
.then(function(response) {
return response.json();
}).then(function(json) {
.then(response => response.json())
.then(json => {
console.log('parsed json', json);
}).catch(function(ex) {
}).catch(ex => {
console.log('parsing failed', ex);
});
fetchJsonp('/users.jsonp', {
jsonpCallback: 'custom_callback'
})
.then(function(response) {
return response.json();
}).then(function(json) {
.then(response => response.json())
.then(json => {
console.log('parsed json', json);
}).catch(function(ex) {
}).catch(ex => {
console.log('parsing failed', ex);
});
@@ -26,11 +24,10 @@ fetchJsonp('/users.jsonp', {
timeout: 3000,
jsonpCallback: 'custom_callback'
})
.then(function(response) {
return response.json();
}).then(function(json) {
.then(response => response.json())
.then(json => {
console.log('parsed json', json);
}).catch(function(ex) {
}).catch(ex => {
console.log('parsing failed', ex);
});
@@ -39,10 +36,9 @@ const result = fetchJsonp('http://www.flickr.com/services/feeds/photos_public.gn
jsonpCallback: 'jsoncallback',
timeout: 3000
});
result.then(function(response) {
return response.json();
}).then(function(json) {
result.then(response => response.json())
.then(json => {
document.body.innerHTML = JSON.stringify(json);
})['catch'](function(ex) {
}).catch(ex => {
document.body.innerHTML = 'failed:' + ex;
});
+172 -172
View File
@@ -15,16 +15,16 @@ type MockMatcherFunction = (url: string, opts: MockRequest) => boolean;
/**
* Mock matcher. Can be one of following:
* string: Either
* an exact url to match e.g. 'http://www.site.com/page.html'
* if the string begins with a `^`, the string following the `^` must
begin the url e.g. '^http://www.site.com' would match
'http://www.site.com' or 'http://www.site.com/page.html'
* '*' to match any url
* RegExp: A regular expression to test the url against
* Function(url, opts): A function (returning a Boolean) that is passed the
url and opts fetch() is called with (or, if fetch() was called with one,
the Request instance)
*/
* * an exact url to match e.g. 'http://www.site.com/page.html'
* * if the string begins with a `^`, the string following the `^` must
* begin the url e.g. '^http://www.site.com' would match
* 'http://www.site.com' or 'http://www.site.com/page.html'
* * '*' to match any url
* RegExp: A regular expression to test the url against
* Function(url, opts): A function (returning a Boolean) that is passed the
* url and opts fetch() is called with (or, if fetch() was called with one,
* the Request instance)
*/
type MockMatcher = string | RegExp | MockMatcherFunction;
/**
@@ -46,14 +46,14 @@ interface MockResponseObject {
headers?: { [key: string]: string };
/**
* If this property is present then a Promise rejected with the value
of throws is returned
*/
* of throws is returned
*/
throws?: boolean;
/**
* This property determines whether or not the request body should be
JSON.stringified before being sent
* @default true
*/
* JSON.stringified before being sent
* @default true
*/
sendAsJson?: boolean;
}
/**
@@ -61,11 +61,11 @@ interface MockResponseObject {
* number: Creates a response with this status
* string: Creates a 200 response with the string as the response body
* object: As long as the object is not a MockResponseObject it is
converted into a json string and returned as the body of a 200 response
* If MockResponseObject was given then it's used to configure response
* Function(url, opts): A function that is passed the url and opts fetch()
is called with and that returns any of the responses listed above
*/
* converted into a json string and returned as the body of a 200 response
* If MockResponseObject was given then it's used to configure response
* Function(url, opts): A function that is passed the url and opts fetch()
* is called with and that returns any of the responses listed above
*/
type MockResponse = Response | Promise<Response>
| number | Promise<number>
| string | Promise<string>
@@ -84,13 +84,13 @@ type MockResponseFunction = (url: string, opts: MockRequest) => MockResponse;
interface MockOptions {
/**
* A unique string naming the route. Used to subsequently retrieve
references to the calls, grouped by name.
* @default matcher.toString()
*
* Note: If a non-unique name is provided no error will be thrown
(because names are optional, auto-generated ones may legitimately
clash)
*/
* references to the calls, grouped by name.
* @default matcher.toString()
*
* Note: If a non-unique name is provided no error will be thrown
* (because names are optional, auto-generated ones may legitimately
* clash)
*/
name?: string;
/**
* http method to match
@@ -106,10 +106,10 @@ interface MockOptions {
response?: MockResponse | MockResponseFunction;
/**
* integer, n, limiting the number of times the matcher can be used.
If the route has already been called n times the route will be
ignored and the call to fetch() will fall through to be handled by
any other routes defined (which may eventually result in an error
if nothing matches it).
* If the route has already been called n times the route will be
* ignored and the call to fetch() will fall through to be handled by
* any other routes defined (which may eventually result in an error
* if nothing matches it).
*/
times?: number;
}
@@ -144,187 +144,187 @@ interface MockOptionsMethodHead extends MockOptions {
interface FetchMockStatic {
/**
* Replaces fetch() with a stub which records its calls, grouped by
route, and optionally returns a mocked Response object or passes the
call through to fetch(). Calls to .mock() can be chained.
* @param matcher Condition for selecting which requests to mock
* @param response Configures the http response returned by the mock
* @param [options] Additional properties defining the route to mock
*/
* route, and optionally returns a mocked Response object or passes the
* call through to fetch(). Calls to .mock() can be chained.
* @param matcher Condition for selecting which requests to mock
* @param response Configures the http response returned by the mock
* @param [options] Additional properties defining the route to mock
*/
mock(matcher: MockMatcher, response: MockResponse | MockResponseFunction, options?: MockOptions): this;
/**
* Replaces fetch() with a stub which records its calls, grouped by
route, and optionally returns a mocked Response object or passes the
call through to fetch(). Calls to .mock() can be chained.
* @param options The route to mock
*/
* route, and optionally returns a mocked Response object or passes the
* call through to fetch(). Calls to .mock() can be chained.
* @param options The route to mock
*/
mock(options: MockOptions): this;
/**
* Replaces fetch() with a stub which records its calls, grouped by
route, and optionally returns a mocked Response object or passes the
call through to fetch(). Shorthand for mock() limited to being
called one time only. Calls to .once() can be chained.
* @param matcher Condition for selecting which requests to mock
* @param response Configures the http response returned by the mock
* @param [options] Optional additional properties defining the route to mock
*/
* route, and optionally returns a mocked Response object or passes the
* call through to fetch(). Shorthand for mock() limited to being
* called one time only. Calls to .once() can be chained.
* @param matcher Condition for selecting which requests to mock
* @param response Configures the http response returned by the mock
* @param [options] Optional additional properties defining the route to mock
*/
once(matcher: MockMatcher, response: MockResponse | MockResponseFunction, options?: MockOptions): this;
/**
* Replaces fetch() with a stub which records its calls, grouped by
route, and optionally returns a mocked Response object or passes the
call through to fetch(). Shorthand for mock() restricted to the GET
method. Calls to .get() can be chained.
* @param matcher Condition for selecting which requests to mock
* @param response Configures the http response returned by the mock
* @param [options] Additional properties defining the route to mock
*/
* route, and optionally returns a mocked Response object or passes the
* call through to fetch(). Shorthand for mock() restricted to the GET
* method. Calls to .get() can be chained.
* @param matcher Condition for selecting which requests to mock
* @param response Configures the http response returned by the mock
* @param [options] Additional properties defining the route to mock
*/
get(matcher: MockMatcher, reponse: MockResponse | MockResponseFunction, options?: MockOptionsMethodGet): this;
/**
* Replaces fetch() with a stub which records its calls, grouped by
route, and optionally returns a mocked Response object or passes the
call through to fetch(). Shorthand for mock() restricted to the GET
method and limited to being called one time only. Calls to .getOnce()
can be chained.
* @param matcher Condition for selecting which requests to mock
* @param response Configures the http response returned by the mock
* @param [options] Additional properties defining the route to mock
*/
* route, and optionally returns a mocked Response object or passes the
* call through to fetch(). Shorthand for mock() restricted to the GET
* method and limited to being called one time only. Calls to .getOnce()
* can be chained.
* @param matcher Condition for selecting which requests to mock
* @param response Configures the http response returned by the mock
* @param [options] Additional properties defining the route to mock
*/
getOnce(matcher: MockMatcher, reponse: MockResponse | MockResponseFunction, options?: MockOptionsMethodGet): this;
/**
* Replaces fetch() with a stub which records its calls, grouped by
route, and optionally returns a mocked Response object or passes the
call through to fetch(). Shorthand for mock() restricted to the POST
method. Calls to .post() can be chained.
* @param matcher Condition for selecting which requests to mock
* @param response Configures the http response returned by the mock
* @param [options] Additional properties defining the route to mock
*/
* route, and optionally returns a mocked Response object or passes the
* call through to fetch(). Shorthand for mock() restricted to the POST
* method. Calls to .post() can be chained.
* @param matcher Condition for selecting which requests to mock
* @param response Configures the http response returned by the mock
* @param [options] Additional properties defining the route to mock
*/
post(matcher: MockMatcher, reponse: MockResponse | MockResponseFunction, options?: MockOptionsMethodPost): this;
/**
* Replaces fetch() with a stub which records its calls, grouped by
route, and optionally returns a mocked Response object or passes the
call through to fetch(). Shorthand for mock() restricted to the POST
method and limited to being called one time only. Calls to .postOnce()
can be chained.
* @param matcher Condition for selecting which requests to mock
* @param response Configures the http response returned by the mock
* @param [options] Additional properties defining the route to mock
*/
* route, and optionally returns a mocked Response object or passes the
* call through to fetch(). Shorthand for mock() restricted to the POST
* method and limited to being called one time only. Calls to .postOnce()
* can be chained.
* @param matcher Condition for selecting which requests to mock
* @param response Configures the http response returned by the mock
* @param [options] Additional properties defining the route to mock
*/
postOnce(matcher: MockMatcher, reponse: MockResponse | MockResponseFunction, options?: MockOptionsMethodPost): this;
/**
* Replaces fetch() with a stub which records its calls, grouped by
route, and optionally returns a mocked Response object or passes the
call through to fetch(). Shorthand for mock() restricted to the PUT
method. Calls to .put() can be chained.
* @param matcher Condition for selecting which requests to mock
* @param response Configures the http response returned by the mock
* @param [options] Additional properties defining the route to mock
*/
* route, and optionally returns a mocked Response object or passes the
* call through to fetch(). Shorthand for mock() restricted to the PUT
* method. Calls to .put() can be chained.
* @param matcher Condition for selecting which requests to mock
* @param response Configures the http response returned by the mock
* @param [options] Additional properties defining the route to mock
*/
put(matcher: MockMatcher, reponse: MockResponse | MockResponseFunction, options?: MockOptionsMethodPut): this;
/**
* Replaces fetch() with a stub which records its calls, grouped by
route, and optionally returns a mocked Response object or passes the
call through to fetch(). Shorthand for mock() restricted to the PUT
method and limited to being called one time only. Calls to .putOnce()
can be chained.
* @param matcher Condition for selecting which requests to mock
* @param response Configures the http response returned by the mock
* @param [options] Additional properties defining the route to mock
*/
* route, and optionally returns a mocked Response object or passes the
* call through to fetch(). Shorthand for mock() restricted to the PUT
* method and limited to being called one time only. Calls to .putOnce()
* can be chained.
* @param matcher Condition for selecting which requests to mock
* @param response Configures the http response returned by the mock
* @param [options] Additional properties defining the route to mock
*/
putOnce(matcher: MockMatcher, reponse: MockResponse | MockResponseFunction, options?: MockOptionsMethodPut): this;
/**
* Replaces fetch() with a stub which records its calls, grouped by
route, and optionally returns a mocked Response object or passes the
call through to fetch(). Shorthand for mock() restricted to the
DELETE method. Calls to .delete() can be chained.
* @param matcher Condition for selecting which requests to mock
* @param response Configures the http response returned by the mock
* @param [options] Additional properties defining the route to mock
*/
* route, and optionally returns a mocked Response object or passes the
* call through to fetch(). Shorthand for mock() restricted to the
* DELETE method. Calls to .delete() can be chained.
* @param matcher Condition for selecting which requests to mock
* @param response Configures the http response returned by the mock
* @param [options] Additional properties defining the route to mock
*/
delete(matcher: MockMatcher, reponse: MockResponse | MockResponseFunction, options?: MockOptionsMethodDelete): this;
/**
* Replaces fetch() with a stub which records its calls, grouped by
route, and optionally returns a mocked Response object or passes the
call through to fetch(). Shorthand for mock() restricted to the
DELETE method and limited to being called one time only. Calls to
.deleteOnce() can be chained.
* @param matcher Condition for selecting which requests to mock
* @param response Configures the http response returned by the mock
* @param [options] Additional properties defining the route to mock
*/
* route, and optionally returns a mocked Response object or passes the
* call through to fetch(). Shorthand for mock() restricted to the
* DELETE method and limited to being called one time only. Calls to
* .deleteOnce() can be chained.
* @param matcher Condition for selecting which requests to mock
* @param response Configures the http response returned by the mock
* @param [options] Additional properties defining the route to mock
*/
deleteOnce(matcher: MockMatcher, reponse: MockResponse | MockResponseFunction, options?: MockOptionsMethodDelete): this;
/**
* Replaces fetch() with a stub which records its calls, grouped by
route, and optionally returns a mocked Response object or passes the
call through to fetch(). Shorthand for mock() restricted to the HEAD
method. Calls to .head() can be chained.
* @param matcher Condition for selecting which requests to mock
* @param response Configures the http response returned by the mock
* @param [options] Additional properties defining the route to mock
*/
* route, and optionally returns a mocked Response object or passes the
* call through to fetch(). Shorthand for mock() restricted to the HEAD
* method. Calls to .head() can be chained.
* @param matcher Condition for selecting which requests to mock
* @param response Configures the http response returned by the mock
* @param [options] Additional properties defining the route to mock
*/
head(matcher: MockMatcher, reponse: MockResponse | MockResponseFunction, options?: MockOptionsMethodHead): this;
/**
* Replaces fetch() with a stub which records its calls, grouped by
route, and optionally returns a mocked Response object or passes the
call through to fetch(). Shorthand for mock() restricted to the HEAD
method and limited to being called one time only. Calls to .headOnce()
can be chained.
* @param matcher Condition for selecting which requests to mock
* @param response Configures the http response returned by the mock
* @param [options] Additional properties defining the route to mock
*/
* route, and optionally returns a mocked Response object or passes the
* call through to fetch(). Shorthand for mock() restricted to the HEAD
* method and limited to being called one time only. Calls to .headOnce()
* can be chained.
* @param matcher Condition for selecting which requests to mock
* @param response Configures the http response returned by the mock
* @param [options] Additional properties defining the route to mock
*/
headOnce(matcher: MockMatcher, reponse: MockResponse | MockResponseFunction, options?: MockOptionsMethodHead): this;
/**
* Replaces fetch() with a stub which records its calls, grouped by
route, and optionally returns a mocked Response object or passes the
call through to fetch(). Shorthand for mock() restricted to the PATCH
method. Calls to .patch() can be chained.
* @param matcher Condition for selecting which requests to mock
* @param response Configures the http response returned by the mock
* @param [options] Additional properties defining the route to mock
*/
* route, and optionally returns a mocked Response object or passes the
* call through to fetch(). Shorthand for mock() restricted to the PATCH
* method. Calls to .patch() can be chained.
* @param matcher Condition for selecting which requests to mock
* @param response Configures the http response returned by the mock
* @param [options] Additional properties defining the route to mock
*/
patch(matcher: MockMatcher, reponse: MockResponse | MockResponseFunction, options?: MockOptionsMethodHead): this;
/**
* Replaces fetch() with a stub which records its calls, grouped by
route, and optionally returns a mocked Response object or passes the
call through to fetch(). Shorthand for mock() restricted to the PATCH
method and limited to being called one time only. Calls to .patchOnce()
can be chained.
* @param matcher Condition for selecting which requests to mock
* @param response Configures the http response returned by the mock
* @param [options] Additional properties defining the route to mock
*/
* route, and optionally returns a mocked Response object or passes the
* call through to fetch(). Shorthand for mock() restricted to the PATCH
* method and limited to being called one time only. Calls to .patchOnce()
* can be chained.
* @param matcher Condition for selecting which requests to mock
* @param response Configures the http response returned by the mock
* @param [options] Additional properties defining the route to mock
*/
patchOnce(matcher: MockMatcher, reponse: MockResponse | MockResponseFunction, options?: MockOptionsMethodHead): this;
/**
* Chainable method that defines how to respond to calls to fetch that
don't match any of the defined mocks. It accepts the same types of
response as a normal call to .mock(matcher, response). It can also
take an arbitrary function to completely customise behaviour of
unmatched calls. If .catch() is called without any parameters then
every unmatched call will receive a 200 response.
* @param [response] Configures the http response returned by the mock
*/
* don't match any of the defined mocks. It accepts the same types of
* response as a normal call to .mock(matcher, response). It can also
* take an arbitrary function to completely customise behaviour of
* unmatched calls. If .catch() is called without any parameters then
* every unmatched call will receive a 200 response.
* @param [response] Configures the http response returned by the mock
*/
catch(response?: MockResponse | MockResponseFunction): this;
/**
* Chainable method that records the call history of unmatched calls,
but instead of responding with a stubbed response, the request is
passed through to native fetch() and is allowed to communicate
over the network. Similar to catch().
*/
* but instead of responding with a stubbed response, the request is
* passed through to native fetch() and is allowed to communicate
* over the network. Similar to catch().
*/
spy(response?: MockResponse | MockResponseFunction): this;
/**
* Chainable method that restores fetch() to its unstubbed state and
clears all data recorded for its calls.
*/
* clears all data recorded for its calls.
*/
restore(): this;
/**
@@ -334,8 +334,8 @@ interface FetchMockStatic {
/**
* Returns all calls to fetch, grouped by whether fetch-mock matched
them or not.
*/
* them or not.
*/
calls(): MatchedRoutes;
/**
* Returns all calls to fetch matching matcherName.
@@ -344,53 +344,53 @@ interface FetchMockStatic {
/**
* Returns a Boolean indicating whether fetch was called and a route
was matched (or a specific route if matcherName is passed).
* was matched (or a specific route if matcherName is passed).
* @param [matcherName] either the name of a route or equal to
matcher.toString() for any unnamed route
*/
* matcher.toString() for any unnamed route
*/
called(matcherName?: string): boolean;
/**
* Returns a Boolean indicating whether fetch was called the expected
number of times (or at least once if the route defines no expectation
is set) for every route (or for a specific route if matcherName is
passed).
* number of times (or at least once if the route defines no expectation
* is set) for every route (or for a specific route if matcherName is
* passed).
* @param [matcherName] either the name of a route or equal to
matcher.toString() for any unnamed route
*/
* matcher.toString() for any unnamed route
*/
done(matcherName?: string): boolean;
/**
* Returns the arguments for the last matched call to fetch (or the
last call to specific route is matcherName is passed).
* last call to specific route is matcherName is passed).
* @param [matcherName] either the name of a route or equal to
matcher.toString() for any unnamed route
* matcher.toString() for any unnamed route
*/
lastCall(matcherName?: string): MockCall;
/**
* Returns the url for the last matched call to fetch (or the last
call to specific route is matcherName is passed).
* call to specific route is matcherName is passed).
* @param [matcherName] either the name of a route or equal to
matcher.toString() for any unnamed route
* matcher.toString() for any unnamed route
*/
lastUrl(matcherName?: string): string;
/**
* Returns the options for the last matched call to fetch (or the
last call to a specific route is matcherName is passed).
* last call to a specific route is matcherName is passed).
* @param [matcherName] either the name of a route or equal to
matcher.toString() for any unnamed route
* matcher.toString() for any unnamed route
*/
lastOptions(matcherName?: string): MockRequest;
/**
* Set some global config options, which include
* sendAsJson [default `true`] - by default fetchMock will
convert objects to JSON before sending. This is overrideable
for each call but for some scenarios, e.g. when dealing with a
lot of array buffers, it can be useful to default to `false`
*/
* sendAsJson [default `true`] - by default fetchMock will
* convert objects to JSON before sending. This is overrideable
* for each call but for some scenarios, e.g. when dealing with a
* lot of array buffers, it can be useful to default to `false`
*/
configure(opts: {}): void;
}
+40 -40
View File
@@ -32,69 +32,69 @@ declare class Board extends NodeJS.EventEmitter {
firmware: Board.Firmware;
settings: Board.Settings;
protected transport: SerialPort;
reportVersion(callback: () => void): void
queryFirmware(callback: () => void): void
analogRead(pin: number, callback: (value: number) => void): void
analogWrite(pin: number, value: number): void
pwmWrite(pin: number, value: number): void
servoConfig(pin: number, min: number, max: number): void
servoWrite(pin: number, value: number): void
pinMode(pin: number, mode: Board.PIN_MODE): void
digitalWrite(pin: number, val: Board.PIN_STATE): void
digitalRead(pin: number, callback: (val: Board.PIN_STATE) => void): void
queryCapabilities(callback: () => void): void
queryAnalogMapping(callback: () => void): void
queryPinState(pin: number, callback: () => void): void
reportVersion(callback: () => void): void;
queryFirmware(callback: () => void): void;
analogRead(pin: number, callback: (value: number) => void): void;
analogWrite(pin: number, value: number): void;
pwmWrite(pin: number, value: number): void;
servoConfig(pin: number, min: number, max: number): void;
servoWrite(pin: number, value: number): void;
pinMode(pin: number, mode: Board.PIN_MODE): void;
digitalWrite(pin: number, val: Board.PIN_STATE): void;
digitalRead(pin: number, callback: (val: Board.PIN_STATE) => void): void;
queryCapabilities(callback: () => void): void;
queryAnalogMapping(callback: () => void): void;
queryPinState(pin: number, callback: () => void): void;
// TODO untested --- TWW
sendString(str: string): void
sendString(str: string): void;
// TODO untested --- TWW
sendI2CConfig(delay: number): void
sendI2CConfig(delay: number): void;
// TODO untested --- TWW
i2cConfig(options: number|{ delay: number }): void
i2cConfig(options: number|{ delay: number }): void;
// TODO untested --- TWW
sendI2CWriteRequest(slaveAddress: number, bytes: number[]): void
sendI2CWriteRequest(slaveAddress: number, bytes: number[]): void;
// TODO untested --- TWW
i2cWrite(address: number, register: number, inBytes: number[]): void
i2cWrite(address: number, data: number[]): void
i2cWrite(address: number, register: number, inBytes: number[]): void;
i2cWrite(address: number, data: number[]): void;
// TODO untested --- TWW
i2cWriteReg(address: number, register: number, byte: number): void
i2cWriteReg(address: number, register: number, byte: number): void;
// TODO untested --- TWW
sendI2CReadRequest(address: number, numBytes: number, callback: () => void): void
sendI2CReadRequest(address: number, numBytes: number, callback: () => void): void;
// TODO untested --- TWW
i2cRead(address: number, register: number, bytesToRead: number, callback: (data: number[]) => void): void
i2cRead(address: number, bytesToRead: number, callback: (data: number[]) => void): void
i2cRead(address: number, register: number, bytesToRead: number, callback: (data: number[]) => void): void;
i2cRead(address: number, bytesToRead: number, callback: (data: number[]) => void): void;
// TODO untested --- TWW
i2cStop(options: number|{ bus: number, address: number }): void
i2cStop(options: number|{ bus: number, address: number }): void;
// TODO untested --- TWW
i2cReadOnce(address: number, register: number, bytesToRead: number, callback: (data: number[]) => void): void
i2cReadOnce(address: number, bytesToRead: number, callback: (data: number[]) => void): void
i2cReadOnce(address: number, register: number, bytesToRead: number, callback: (data: number[]) => void): void;
i2cReadOnce(address: number, bytesToRead: number, callback: (data: number[]) => void): void;
// TODO untested --- TWW
sendOneWireConfig(pin: number, enableParasiticPower: boolean): void
sendOneWireConfig(pin: number, enableParasiticPower: boolean): void;
// TODO untested --- TWW
sendOneWireSearch(pin: number, callback: () => void): void
sendOneWireSearch(pin: number, callback: () => void): void;
// TODO untested --- TWW
sendOneWireAlarmsSearch(pin: number, callback: () => void): void
sendOneWireAlarmsSearch(pin: number, callback: () => void): void;
// TODO untested --- TWW
sendOneWireRead(pin: number, device: number, numBytesToRead: number, callback: () => void): void
sendOneWireRead(pin: number, device: number, numBytesToRead: number, callback: () => void): void;
// TODO untested --- TWW
sendOneWireReset(pin: number): void
sendOneWireReset(pin: number): void;
// TODO untested --- TWW
sendOneWireWrite(pin: number, device: number, data: number|number[]): void
sendOneWireWrite(pin: number, device: number, data: number|number[]): void;
// TODO untested --- TWW
sendOneWireDelay(pin: number, delay: number): void
sendOneWireDelay(pin: number, delay: number): void;
// TODO untested --- TWW
sendOneWireWriteAndRead(
pin: number,
device: number,
data: number|number[],
numBytesToRead: number,
callback: (error?: Error, data?: number) => void): void
setSamplingInterval(interval: number): void
getSamplingInterval(): number
reportAnalogPin(pin: number, value: Board.REPORTING): void
reportDigitalPin(pin: number, value: Board.REPORTING): void
callback: (error?: Error, data?: number) => void): void;
setSamplingInterval(interval: number): void;
getSamplingInterval(): number;
reportAnalogPin(pin: number, value: Board.REPORTING): void;
reportDigitalPin(pin: number, value: Board.REPORTING): void;
// TODO untested/incomplete --- TWW
pingRead(opts: any, callback: () => void): void
pingRead(opts: any, callback: () => void): void;
stepperConfig(
deviceNum: number,
type: number,
@@ -102,7 +102,7 @@ declare class Board extends NodeJS.EventEmitter {
dirOrMotor1Pin: number,
stepOrMotor2Pin: number,
motor3Pin?: number,
motor4Pin?: number): void
motor4Pin?: number): void;
stepperStep(
deviceNum: number,
direction: Board.STEPPER_DIRECTION,
File diff suppressed because it is too large Load Diff
+19 -26
View File
@@ -4,11 +4,10 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace flatbuffers {
/**
* @typedef {number}
*/
export type Offset = number;
type Offset = number;
/**
* @typedef {{
@@ -16,7 +15,7 @@ declare namespace flatbuffers {
* bb_pos: number
* }}
*/
export interface Table {
interface Table {
bb: ByteBuffer;
bb_pos: number;
}
@@ -25,53 +24,52 @@ declare namespace flatbuffers {
* @type {number}
* @const
*/
export const SIZEOF_SHORT: number;
const SIZEOF_SHORT: number;
/**
* @type {number}
* @const
*/
export const SIZEOF_INT: number;
const SIZEOF_INT: number;
/**
* @type {number}
* @const
*/
export const FILE_IDENTIFIER_LENGTH: number;
const FILE_IDENTIFIER_LENGTH: number;
/**
* @enum {number}
*/
export enum Encoding { UTF8_BYTES, UTF16_STRING }
enum Encoding { UTF8_BYTES, UTF16_STRING }
/**
* @type {Int32Array}
* @const
*/
export var int32: Int32Array;
const int32: Int32Array;
/**
* @type {Float32Array}
* @const
*/
export var float32: Float32Array;
const float32: Float32Array;
/**
* @type {Float64Array}
* @const
*/
export var float64: Float64Array;
const float64: Float64Array;
/**
* @type {boolean}
* @const
*/
export var isLittleEndian: boolean;
const isLittleEndian: boolean;
////////////////////////////////////////////////////////////////////////////////
export class Long {
class Long {
/**
* @type {number}
* @const
@@ -110,16 +108,14 @@ declare namespace flatbuffers {
/**
* @param {number} low
* @param {number} high
* @param {number} high
*/
static create(low: number, high: number): Long;
}
////////////////////////////////////////////////////////////////////////////////
export class Builder {
class Builder {
/**
* @constructor
* @param {number=} initial_size
@@ -393,19 +389,17 @@ declare namespace flatbuffers {
/**
* Conveniance function for creating Long objects.
*
* @param {number} low
* @param {number} high
*
* @param {number} low
* @param {number} high
* @returns {Long}
*/
createLong(low: number, high: number): Long;
}
////////////////////////////////////////////////////////////////////////////////
class ByteBuffer {
/**
* @constructor
* @param {Uint8Array} bytes
@@ -599,12 +593,11 @@ declare namespace flatbuffers {
/**
* Conveniance function for creating Long objects.
*
* @param {number} low
* @param {number} high
*
* @param {number} low
* @param {number} high
* @returns {Long}
*/
createLong(low: number, high: number): Long;
}
}
+6 -1
View File
@@ -1 +1,6 @@
{ "extends": "../tslint.json" }
{
"extends": "../tslint.json",
"rules": {
"align": false
}
}
+1 -1
View File
@@ -49,7 +49,7 @@ declare namespace Flatpickr {
onYearChange?: EventCallback | EventCallback[];
onValueUpdate?: EventCallback | EventCallback[];
onDayCreate?: EventCallback | EventCallback[];
parseDate?: (date: string) => Date;
parseDate?(date: string): Date;
prevArrow?: string;
shorthandCurrentMonth?: boolean;
static?: boolean;
+1 -2
View File
@@ -32,7 +32,7 @@ export interface Options {
logFile?: string;
outFile?: string;
errFile?: string;
parser?: (command: string, args: string[]) => { command: string, args: string[] };
parser?(command: string, args: string[]): { command: string, args: string[] };
}
export function start(script: string, options?: Options): Monitor;
@@ -41,7 +41,6 @@ export function checkProcess(pid: number): boolean;
export const version: string;
export class Monitor extends NodeJS.EventEmitter {
/**
* @param script - Location of the target script to run.
* @param [options] - Configuration for this instance.
+1 -1
View File
@@ -1,7 +1,7 @@
import 'format-unicorn';
// Unsafe version
var outputString: string;
let outputString: string;
outputString = 'Hello, {name}; you have {favoriteNumber}'.formatUnicorn({
name: "kruncher",
+1 -1
View File
@@ -1,7 +1,7 @@
import formatUnicorn = require('format-unicorn/safe');
// Safe version
var outputString: string;
let outputString: string;
outputString = formatUnicorn('Hello, {name}; you have {favoriteNumber}', {
name: "kruncher",
+4 -4
View File
@@ -102,7 +102,7 @@ export interface Options extends AgendaOptions, EventDraggingResizingOptions, Dr
*
* - EventObject[]
* - string (JSON feed)
* - (start: moment.Moment, end: moment.Moment, timezone: string | boolean, callback: {(events: EventObject[]) => void;}) => void;
* - (start: moment.Moment, end: moment.Moment, timezone: string | boolean, callback: {(events: EventObject[]) => void;}) => void;
*/
events?: any;
@@ -112,7 +112,7 @@ export interface Options extends AgendaOptions, EventDraggingResizingOptions, Dr
* - EventSource
* - EventObject[]
* - string (JSON feed)
* - (start: moment.Moment, end: moment.Moment, timezone: string | boolean, callback: {(events: EventObject[]) => void;}) => void;
* - (start: moment.Moment, end: moment.Moment, timezone: string | boolean, callback: {(events: EventObject[]) => void;}) => void;
*/
eventSources?: any[];
@@ -145,7 +145,7 @@ export interface Options extends AgendaOptions, EventDraggingResizingOptions, Dr
}
/**
* Agenda Options - http://fullcalendar.io/docs/agenda/
* Agenda Options - http://fullcalendar.io/docs/agenda/
*/
export interface AgendaOptions {
allDaySlot?: boolean;
@@ -244,7 +244,7 @@ export interface EventSource extends JQueryAjaxSettings {
*
* - EventObject[]
* - string (JSON feed)
* - (start: moment.Moment, end: moment.Moment, timezone: string | boolean, callback: {(events: EventObject[]) => void;}) => void;
* - (start: moment.Moment, end: moment.Moment, timezone: string | boolean, callback: {(events: EventObject[]) => void;}) => void;
*/
events?: any;
+1 -1
View File
@@ -1,5 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var charts: (H: FusionChartStatic) => FusionChartStatic;
declare function charts(H: FusionChartStatic): FusionChartStatic;
export = charts;
export as namespace charts;
+1 -1
View File
@@ -1,5 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var gantt: (H: FusionChartStatic) => FusionChartStatic;
declare function gantt(H: FusionChartStatic): FusionChartStatic;
export = gantt;
export as namespace gantt;
+1 -1
View File
@@ -1,5 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var maps: (H: FusionChartStatic) => FusionChartStatic;
declare function maps(H: FusionChartStatic): FusionChartStatic;
export = maps;
export as namespace maps;
+1 -1
View File
@@ -1,5 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var powercharts: (H: FusionChartStatic) => FusionChartStatic;
declare function powercharts(H: FusionChartStatic): FusionChartStatic;
export = powercharts;
export as namespace powercharts;
+1 -1
View File
@@ -1,5 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var ssgrid: (H: FusionChartStatic) => FusionChartStatic;
declare function ssgrid(H: FusionChartStatic): FusionChartStatic;
export = ssgrid;
export as namespace ssgrid;
+1 -1
View File
@@ -1,5 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var treemap: (H: FusionChartStatic) => FusionChartStatic;
declare function treemap(H: FusionChartStatic): FusionChartStatic;
export = treemap;
export as namespace treemap;
+1 -1
View File
@@ -1,5 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var widgets: (H: FusionChartStatic) => FusionChartStatic;
declare function widgets(H: FusionChartStatic): FusionChartStatic;
export = widgets;
export as namespace widgets;
+1 -1
View File
@@ -1,5 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var zoomscatter: (H: FusionChartStatic) => FusionChartStatic;
declare function zoomscatter(H: FusionChartStatic): FusionChartStatic;
export = zoomscatter;
export as namespace zoomscatter;
+3 -3
View File
@@ -19,15 +19,15 @@ declare namespace FusionCharts {
cancelled: boolean;
stopPropagation: () => void;
stopPropagation(): void;
prevented: boolean;
preventDefault: () => void;
preventDefault(): void;
detached: boolean;
detachHandler: () => void;
detachHandler(): void;
}
interface ChartObject {
+1 -1
View File
@@ -1,5 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var usa: (H: FusionChartStatic) => FusionChartStatic;
declare function usa(H: FusionChartStatic): FusionChartStatic;
export = usa;
export as namespace usa;
+1 -1
View File
@@ -1,5 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var world: (H: FusionChartStatic) => FusionChartStatic;
declare function world(H: FusionChartStatic): FusionChartStatic;
export = world;
export as namespace world;
+1 -1
View File
@@ -1,5 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var carbon: (H: FusionChartStatic) => FusionChartStatic;
declare function carbon(H: FusionChartStatic): FusionChartStatic;
export = carbon;
export as namespace carbon;
+1 -1
View File
@@ -1,5 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var fint: (H: FusionChartStatic) => FusionChartStatic;
declare function fint(H: FusionChartStatic): FusionChartStatic;
export = fint;
export as namespace fint;
+1 -1
View File
@@ -1,5 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var ocean: (H: FusionChartStatic) => FusionChartStatic;
declare function ocean(H: FusionChartStatic): FusionChartStatic;
export = ocean;
export as namespace ocean;
+1 -1
View File
@@ -1,5 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var zune: (H: FusionChartStatic) => FusionChartStatic;
declare function zune(H: FusionChartStatic): FusionChartStatic;
export = zune;
export as namespace zune;
+52 -19
View File
@@ -542,30 +542,63 @@ declare namespace UniversalAnalytics {
l: number;
q: any[];
(command: 'send', hitType: 'event', eventCategory: string, eventAction: string,
eventLabel?: string, eventValue?: number, fieldsObject?: FieldsObject): void;
(command: 'send', hitType: 'event', fieldsObject: {
(
command: 'send',
hitType: 'event',
eventCategory: string,
eventAction: string,
eventLabel?: string,
eventValue?: number,
nonInteraction?: boolean}): void;
(command: 'send', fieldsObject: {
hitType: HitType, // 'event'
eventCategory: string,
eventAction: string,
eventLabel?: string,
eventValue?: number,
nonInteraction?: boolean}): void;
fieldsObject?: FieldsObject): void;
(
command: 'send',
hitType: 'event',
fieldsObject: {
eventCategory: string,
eventAction: string,
eventLabel?: string,
eventValue?: number,
nonInteraction?: boolean
}): void;
(
command: 'send',
fieldsObject: {
hitType: HitType, // 'event'
eventCategory: string,
eventAction: string,
eventLabel?: string,
eventValue?: number,
nonInteraction?: boolean
}): void;
(command: 'send', hitType: 'pageview', page: string): void;
(command: 'send', hitType: 'social',
socialNetwork: string, socialAction: string, socialTarget: string): void;
(command: 'send', hitType: 'social',
fieldsObject: {socialNetwork: string, socialAction: string, socialTarget: string}): void;
(command: 'send', hitType: 'timing',
timingCategory: string, timingVar: string, timingValue: number): void;
(command: 'send', hitType: 'timing',
fieldsObject: {timingCategory: string, timingVar: string, timingValue: number}): void;
(
command: 'send',
hitType: 'social',
socialNetwork: string,
socialAction: string,
socialTarget: string): void;
(
command: 'send',
hitType: 'social',
fieldsObject: {
socialNetwork: string,
socialAction: string,
socialTarget: string
}): void;
(
command: 'send',
hitType: 'timing',
timingCategory: string,
timingVar: string,
timingValue: number): void;
(
command: 'send',
hitType: 'timing',
fieldsObject: {
timingCategory: string,
timingVar: string,
timingValue: number
}): void;
(command: 'send', fieldsObject: FieldsObject): void;
(command: string, hitType: HitType, ...fields: any[]): void;
+1 -1
View File
@@ -60,7 +60,7 @@ interface ClientOptions {
* @param {metrics}
* @return void
*/
callback?: (error: Error, metrics: any) => void;
callback?(error: Error, metrics: any): void;
}
export class Client {
+6 -5
View File
@@ -149,7 +149,7 @@ const prf: GraphQLFieldConfig<any, any> = pluralIdentifyingRootField({
// An example usage of these methods from the test schema:
const {nodeInterface, nodeField} = nodeDefinitions(
(globalId) => {
var {type, id} = fromGlobalId(globalId);
const {type, id} = fromGlobalId(globalId);
return "data[type][id]";
},
(obj) => {
@@ -180,7 +180,8 @@ mutationWithClientMutationId({
name: "M",
description: "D",
inputFields: gifcm,
mutateAndGetPayload: (object: any,
mutateAndGetPayload: (
object: any,
ctx: any,
info: GraphQLResolveInfo) => {
return new Promise<string>((resolve) => {
@@ -191,7 +192,7 @@ mutationWithClientMutationId({
});
// An example usage of these methods from the test schema:
const data: any = {};
var shipMutation = mutationWithClientMutationId({
const shipMutation = mutationWithClientMutationId({
name: 'IntroduceShip',
inputFields: {
shipName: {
@@ -212,7 +213,7 @@ var shipMutation = mutationWithClientMutationId({
}
},
mutateAndGetPayload: ({shipName, factionId}) => {
var newShip = {
const newShip = {
id: "11",
name: shipName
};
@@ -225,7 +226,7 @@ var shipMutation = mutationWithClientMutationId({
}
});
var mutationType = new GraphQLObjectType({
const mutationType = new GraphQLObjectType({
name: 'Mutation',
fields: () => ({
introduceShip: shipMutation
+7 -10
View File
@@ -3,7 +3,6 @@
// Definitions by: Arvitaly <https://github.com/arvitaly>, nitintutlani <https://github.com/nitintutlani>, Grelinfo <https://github.com/Grelinfo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import {
GraphQLBoolean,
GraphQLInt,
@@ -123,7 +122,6 @@ interface ConnectionArguments {
last?: number;
}
// connection/arrayconnection.js
interface ArraySliceMetaInfo {
@@ -154,11 +152,11 @@ export function connectionFromPromisedArray<T>(
* Given a slice (subset) of an array, returns a connection object for use in
* GraphQL.
*
* This function is similar to `connectionFromArray`, but is intended for use
* cases where you know the cardinality of the connection, consider it too large
* to materialize the entire array, and instead wish pass in a slice of the
* total result large enough to cover the range specified in `args`.
*/
* This function is similar to `connectionFromArray`, but is intended for use
* cases where you know the cardinality of the connection, consider it too large
* to materialize the entire array, and instead wish pass in a slice of the
* total result large enough to cover the range specified in `args`.
*/
export function connectionFromArraySlice<T>(
arraySlice: T[],
args: ConnectionArguments,
@@ -294,17 +292,16 @@ export function globalIdField(
idFetcher?: (object: any, context: any, info: GraphQLResolveInfo) => string
): GraphQLFieldConfig<any, any>;
// node/plural.js
interface PluralIdentifyingRootFieldConfig {
argName: string;
inputType: GraphQLInputType;
outputType: GraphQLOutputType;
resolveSingleInput: (input: any, context: any, info: GraphQLResolveInfo) => any;
resolveSingleInput(input: any, context: any, info: GraphQLResolveInfo): any;
description?: string;
}
export function pluralIdentifyingRootField(
config: PluralIdentifyingRootFieldConfig
): GraphQLFieldConfig<any, any>;
): GraphQLFieldConfig<any, any>;
+2 -2
View File
@@ -1,7 +1,7 @@
import Hapi = require('hapi');
import hapiAuthJwt2 = require('hapi-auth-jwt2');
var server = new Hapi.Server();
const server = new Hapi.Server();
server.connection({port: 8000});
interface User {
@@ -13,7 +13,7 @@ interface Users {
[id: number]: User;
}
var users: Users = {
const users: Users = {
1: {
id: 1,
name: 'Test User'
+49 -49
View File
@@ -33,93 +33,93 @@ type KeyLookupCallback = (err: any, key: string, extraInfo?: any) => void;
type ValidateCallback = (err: any, valid: boolean, credentials?: any) => void;
/**
* Options passed to `hapi.auth.strategy` when this plugin is used
*/
* Options passed to `hapi.auth.strategy` when this plugin is used
*/
export interface Options {
/**
* The secret key used to check the signature of the token *or* a *key lookup function*
*/
* The secret key used to check the signature of the token *or* a *key lookup function*
*/
key?: string | KeyLookup;
/**
* The function which is run once the Token has been decoded
*
* @param decoded the *decoded* and *verified* JWT received from the client in *request.headers.authorization*
* @param request the original *request* received from the client
* @param callback the validation callback
*/
* The function which is run once the Token has been decoded
*
* @param decoded the *decoded* and *verified* JWT received from the client in *request.headers.authorization*
* @param request the original *request* received from the client
* @param callback the validation callback
*/
validateFunc(decoded: {}, request: Request, callback: ValidateCallback): void;
/**
* Settings to define how tokens are verified by the jsonwebtoken library
*/
* Settings to define how tokens are verified by the jsonwebtoken library
*/
verifyOptions?: {
/**
* Ignore expired tokens
*/
* Ignore expired tokens
*/
ignoreExpiration?: boolean;
/**
* Do not enforce token audience
*/
* Do not enforce token audience
*/
audience?: boolean;
/**
* Do not require the issuer to be valid
*/
* Do not require the issuer to be valid
*/
issuer?: boolean;
/**
* List of allowed algorithms
*/
* List of allowed algorithms
*/
algorithms?: string[];
};
/**
* function called to decorate the response with authentication headers
* before the response headers or payload is written
*
* @param request the Request object
* @param reply is called if an error occurred
*/
* function called to decorate the response with authentication headers
* before the response headers or payload is written
*
* @param request the Request object
* @param reply is called if an error occurred
*/
responseFunc?(request: Request, reply: (err: any, response: Response) => void): void;
/**
* If you prefer to pass your token via url, simply add a token url
* parameter to your request or use a custom parameter by setting `urlKey.
* To disable the url parameter set urlKey to `false` or ''.
* @default 'token'
*/
* If you prefer to pass your token via url, simply add a token url
* parameter to your request or use a custom parameter by setting `urlKey.
* To disable the url parameter set urlKey to `false` or ''.
* @default 'token'
*/
urlKey?: string | boolean;
/**
* If you prefer to set your own cookie key or your project has a cookie
* called 'token' for another purpose, you can set a custom key for your
* cookie by setting `options.cookieKey='yourkeyhere'`. To disable cookies
* set cookieKey to `false` or ''.
* @default 'token'
*/
* If you prefer to set your own cookie key or your project has a cookie
* called 'token' for another purpose, you can set a custom key for your
* cookie by setting `options.cookieKey='yourkeyhere'`. To disable cookies
* set cookieKey to `false` or ''.
* @default 'token'
*/
cookieKey?: string | boolean;
/**
* If you want to set a custom key for your header token use the
* `headerKey` option. To disable header token set headerKey to `false` or
* ''.
* @default 'authorization'
*/
* If you want to set a custom key for your header token use the
* `headerKey` option. To disable header token set headerKey to `false` or
* ''.
* @default 'authorization'
*/
headerKey?: string | boolean;
/**
* Allow custom token type, e.g. `Authorization: <tokenType> 12345678`
*/
* Allow custom token type, e.g. `Authorization: <tokenType> 12345678`
*/
tokenType?: string;
/**
* Set to `true` to receive the complete token (`decoded.header`,
* `decoded.payload` and `decoded.signature`) as decoded argument to key
* lookup and `verifyFunc` callbacks (*not `validateFunc`*)
* @default false
*/
* Set to `true` to receive the complete token (`decoded.header`,
* `decoded.payload` and `decoded.signature`) as decoded argument to key
* lookup and `verifyFunc` callbacks (*not `validateFunc`*)
* @default false
*/
complete?: boolean;
}
+5809 -5809
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -6,4 +6,4 @@ indentString('Unicorns\nRainbows', 4);
indentString('Unicorns\nRainbows', 4, '♥');
// => '♥♥♥♥Unicorns'
// => '♥♥♥♥Rainbows'
// => '♥♥♥♥Rainbows'
@@ -1,13 +1,11 @@
import IntlMessageFormat = require("intl-messageformat");
let msg = new IntlMessageFormat("message", "en-us");
var msg = new IntlMessageFormat("message", "en-us");
var output = msg.format({name: "Eric"});
let output = msg.format({name: "Eric"});
console.log(output); // => "My name is Eric."
var MESSAGES = {
const MESSAGES = {
'en-US': {
NUM_PHOTOS: 'You have {numPhotos, plural, ' +
'=0 {no photos.}' +
@@ -23,16 +21,15 @@ var MESSAGES = {
}
};
var enNumPhotos = new IntlMessageFormat(MESSAGES['en-US'].NUM_PHOTOS, 'en-US');
const enNumPhotos = new IntlMessageFormat(MESSAGES['en-US'].NUM_PHOTOS, 'en-US');
output = enNumPhotos.format({numPhotos: 1000});
console.log(output); // => "You have 1,000 photos."
var esNumPhotos = new IntlMessageFormat(MESSAGES['es-MX'].NUM_PHOTOS, 'es-MX');
const esNumPhotos = new IntlMessageFormat(MESSAGES['es-MX'].NUM_PHOTOS, 'es-MX');
output = esNumPhotos.format({numPhotos: 1000});
console.log(output); // => "Usted tiene 1,000 fotos."
var msg = new IntlMessageFormat('The price is: {price, number, USD}', 'en-US', {
msg = new IntlMessageFormat('The price is: {price, number, USD}', 'en-US', {
number: {
USD: {
style : 'currency',
@@ -41,5 +38,5 @@ var msg = new IntlMessageFormat('The price is: {price, number, USD}', 'en-US', {
}
});
var output = msg.format({price: 100});
console.log(output); // => "The price is: $100.00"
output = msg.format({price: 100});
console.log(output); // => "The price is: $100.00"
+9 -10
View File
@@ -6,7 +6,6 @@
/// <reference types="jquery"/>
declare namespace IsotopeLibrary {
type LayoutModes = 'masonry' | 'fitRows' | 'cellsByRow' | 'vertical' | 'packery' | 'masonryHorizontal' | 'fitColumns' | 'cellsByColumn' | 'horiz';
type Elements = HTMLElement[] | HTMLElement | JQuery | NodeList;
@@ -125,9 +124,9 @@ declare namespace IsotopeLibrary {
interface Isotope {
/**
* Adds item elements to the Isotope instance. addItems does not lay out items like appended, prepended, or insert.
* @param elements Element, jQuery Object, NodeList, or Array of Elements
*/
* Adds item elements to the Isotope instance. addItems does not lay out items like appended, prepended, or insert.
* @param elements Element, jQuery Object, NodeList, or Array of Elements
*/
addItems(elements: Elements): void;
/**
* Adds and lays out newly appended item elements to the end of the layout.
@@ -266,7 +265,7 @@ declare namespace IsotopeLibrary {
}
}
interface Isotope extends IsotopeLibrary.Isotope{ }
interface Isotope extends IsotopeLibrary.Isotope { }
declare var Isotope: {
prototype: IsotopeLibrary.Isotope;
@@ -274,11 +273,11 @@ declare var Isotope: {
/**
* Get the Isotope instance via its element. Isotope.data() is useful for getting the Isotope instance in JavaScript, after it has been initalized in HTML.
*/
data: (element: HTMLElement | string) => IsotopeLibrary.Isotope;
}
data(element: HTMLElement | string): IsotopeLibrary.Isotope;
};
interface JQuery {
// tslint:disable:unified-signatures
// tslint:disable:unified-signatures
/**
* Get the Isotope instance from a jQuery object. Isotope instances are useful to access Isotope properties.
*/
@@ -323,7 +322,7 @@ interface JQuery {
* Reveals hidden items.
* @param elements Element, jQuery Object, NodeList, or Array of Elements
*/
isotope(methodName: 'revealItemElements', elements: IsotopeLibrary.Elements): JQuery;
isotope(methodName: 'revealItemElements', elements: IsotopeLibrary.Elements): JQuery;
/**
* Stamps elements in the layout. Isotope will lay out item elements around stamped elements.
* Stamping is only supported by some layout modes: masonry, packery and masonryhorizontal.
@@ -371,4 +370,4 @@ interface JQuery {
*/
isotope(options: IsotopeLibrary.IsotopeOptions): JQuery;
// tslint:enable
}
}
+8 -8
View File
@@ -11,7 +11,7 @@ let $grid = $('.grid').isotope({
rowHeight: 250
},
containerStyle: {
'display': 'block'
display: 'block'
},
filter: 'filter',
fitRows: {
@@ -21,16 +21,16 @@ let $grid = $('.grid').isotope({
itemSelector: '.grid-item',
layoutMode: 'cellsByRow',
getSortData: {
'value': '.value',
'key': (itemElm: JQuery): string => {
value: '.value',
key: (itemElm: JQuery): string => {
return '.key';
},
'description': (itemElm: JQuery): number => {
description: (itemElm: JQuery): number => {
return 1;
}
},
hiddenStyle: {
'display': 'none'
display: 'none'
},
horiz: {
verticalAligment: 10
@@ -63,7 +63,7 @@ let $grid = $('.grid').isotope({
horizontalAlignment: 10
},
visibleStyle: {
'display': 'inline-block'
display: 'inline-block'
}
});
@@ -73,7 +73,7 @@ $grid = $('.grid').isotope({
return true;
},
sortAscending: {
'key': true
key: true
},
stagger: 'a',
transitionDuration: 0.4
@@ -81,7 +81,7 @@ $grid = $('.grid').isotope({
// test methods using jquery
$grid.isotope('addItems', $('.items'));
$grid.isotope('appended', $('.items')[0])
$grid.isotope('appended', $('.items')[0]);
$grid.isotope('hideItemElements', [ new HTMLElement() ]);
$grid.isotope('insert', new HTMLElement());
$grid.isotope('prepended', new NodeList());
+5 -2
View File
@@ -1,3 +1,6 @@
{
"extends": "../tslint.json"
{
"extends": "../tslint.json",
"rules": {
"no-empty-interface": false
}
}
+48 -46
View File
@@ -751,11 +751,13 @@ describe('FakeRequest', () => {
});
describe("Jasmine Mock Ajax (for toplevel)", () => {
// tslint:disable one-variable-per-declaration
let request, anotherRequest, response;
let success, error, complete;
let client, onreadystatechange;
const sharedContext: any = {};
let fakeGlobal, mockAjax;
// tslint:enable
beforeEach(() => {
const fakeXMLHttpRequest = jasmine.createSpy('realFakeXMLHttpRequest');
@@ -1266,8 +1268,8 @@ describe('ParamParser', () => {
});
it('has a default parser', () => {
const parser = this.parser.findParser({ contentType: () => { } }),
parsed = parser.parse('3+stooges=shemp&3+stooges=larry%20%26%20moe%20%26%20curly&some%3Dthing=else+entirely');
const parser = this.parser.findParser({ contentType: () => { } });
const parsed = parser.parse('3+stooges=shemp&3+stooges=larry%20%26%20moe%20%26%20curly&some%3Dthing=else+entirely');
expect(parsed).toEqual({
'3 stooges': ['shemp', 'larry & moe & curly'],
@@ -1284,9 +1286,9 @@ describe('ParamParser', () => {
containing: 'stuff'
}
}
},
parser = this.parser.findParser({ contentType: () => 'application/json' }),
parsed = parser.parse(JSON.stringify(data));
};
const parser = this.parser.findParser({ contentType: () => 'application/json' });
const parsed = parser.parse(JSON.stringify(data));
expect(parsed).toEqual(data);
});
@@ -1300,9 +1302,9 @@ describe('ParamParser', () => {
containing: 'stuff'
}
}
},
parser = this.parser.findParser({ contentType: () => 'application/json; charset=utf-8' }),
parsed = parser.parse(JSON.stringify(data));
};
const parser = this.parser.findParser({ contentType: () => 'application/json; charset=utf-8' });
const parsed = parser.parse(JSON.stringify(data));
expect(parsed).toEqual(data);
});
@@ -1315,8 +1317,8 @@ describe('ParamParser', () => {
this.parser.add(custom);
const parser = this.parser.findParser({ contentType: () => { } }),
parsed = parser.parse('custom_format');
const parser = this.parser.findParser({ contentType: () => { } });
const parsed = parser.parse('custom_format');
expect(parsed).toEqual('parsedFormat');
expect(custom.test).toHaveBeenCalled();
@@ -1331,8 +1333,8 @@ describe('ParamParser', () => {
this.parser.add(custom);
const parser = this.parser.findParser({ contentType: () => { } }),
parsed = parser.parse('custom_format');
const parser = this.parser.findParser({ contentType: () => { } });
const parsed = parser.parse('custom_format');
expect(parsed).toEqual({ custom_format: ['undefined'] });
expect(custom.test).toHaveBeenCalled();
@@ -1347,8 +1349,8 @@ describe('ParamParser', () => {
this.parser.add(custom);
let parser = this.parser.findParser({ contentType: () => { } }),
parsed = parser.parse('custom_format');
let parser = this.parser.findParser({ contentType: () => { } });
let parsed = parser.parse('custom_format');
expect(parsed).toEqual('parsedFormat');
@@ -1541,8 +1543,8 @@ describe('EventBus', () => {
});
it('only triggers callbacks for the specified event', () => {
const fooCallback = jasmine.createSpy('foo'),
barCallback = jasmine.createSpy('bar');
const fooCallback = jasmine.createSpy('foo');
const barCallback = jasmine.createSpy('bar');
this.bus.addEventListener('foo', fooCallback);
this.bus.addEventListener('bar', barCallback);
@@ -1599,7 +1601,7 @@ describe('EventBus', () => {
});
describe("Webmock style mocking", () => {
let successSpy, response, fakeGlobal, mockAjax;
let successSpy, response, fakeGlobal, mockAjax; // tslint:disable-line one-variable-per-declaration
const sendRequest = function(fakeGlobal, url?, method?) {
url = url || "http://example.com/someApi";
@@ -1685,10 +1687,10 @@ describe("withMock", () => {
};
it("installs the mock for passed in function, and uninstalls when complete", () => {
const xmlHttpRequest = jasmine.createSpyObj('XMLHttpRequest', ['open', 'send']),
xmlHttpRequestCtor = spyOn(window as any, 'XMLHttpRequest').and.returnValue(xmlHttpRequest),
fakeGlobal = { XMLHttpRequest: xmlHttpRequestCtor },
mockAjax = new MockAjax(fakeGlobal);
const xmlHttpRequest = jasmine.createSpyObj('XMLHttpRequest', ['open', 'send']);
const xmlHttpRequestCtor = spyOn(window as any, 'XMLHttpRequest').and.returnValue(xmlHttpRequest);
const fakeGlobal = { XMLHttpRequest: xmlHttpRequestCtor };
const mockAjax = new MockAjax(fakeGlobal);
mockAjax.withMock(() => {
sendRequest(fakeGlobal);
@@ -1700,10 +1702,10 @@ describe("withMock", () => {
});
it("properly uninstalls when the passed in function throws", () => {
const xmlHttpRequest = jasmine.createSpyObj('XMLHttpRequest', ['open', 'send']),
xmlHttpRequestCtor = spyOn(window as any, 'XMLHttpRequest').and.returnValue(xmlHttpRequest),
fakeGlobal = { XMLHttpRequest: xmlHttpRequestCtor },
mockAjax = new MockAjax(fakeGlobal);
const xmlHttpRequest = jasmine.createSpyObj('XMLHttpRequest', ['open', 'send']);
const xmlHttpRequestCtor = spyOn(window as any, 'XMLHttpRequest').and.returnValue(xmlHttpRequest);
const fakeGlobal = { XMLHttpRequest: xmlHttpRequestCtor };
const mockAjax = new MockAjax(fakeGlobal);
expect(() => {
mockAjax.withMock(() => {
@@ -1718,9 +1720,9 @@ describe("withMock", () => {
describe("mockAjax", () => {
it("throws an error if installed multiple times", () => {
const fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'),
fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest },
mockAjax = new MockAjax(fakeGlobal);
const fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest');
const fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest };
const mockAjax = new MockAjax(fakeGlobal);
function doubleInstall() {
mockAjax.install();
@@ -1731,9 +1733,9 @@ describe("mockAjax", () => {
});
it("does not throw an error if uninstalled between installs", () => {
const fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'),
fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest },
mockAjax = new MockAjax(fakeGlobal);
const fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest');
const fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest };
const mockAjax = new MockAjax(fakeGlobal);
function sequentialInstalls() {
mockAjax.install();
@@ -1745,9 +1747,9 @@ describe("mockAjax", () => {
});
it("does not replace XMLHttpRequest until it is installed", () => {
const fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'),
fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest },
mockAjax = new MockAjax(fakeGlobal);
const fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest');
const fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest };
const mockAjax = new MockAjax(fakeGlobal);
fakeGlobal.XMLHttpRequest('foo');
expect(fakeXmlHttpRequest).toHaveBeenCalledWith('foo');
@@ -1759,9 +1761,9 @@ describe("mockAjax", () => {
});
it("replaces the global XMLHttpRequest on uninstall", () => {
const fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'),
fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest },
mockAjax = new MockAjax(fakeGlobal);
const fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest');
const fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest };
const mockAjax = new MockAjax(fakeGlobal);
mockAjax.install();
mockAjax.uninstall();
@@ -1771,9 +1773,9 @@ describe("mockAjax", () => {
});
it("clears requests and stubs upon uninstall", () => {
const fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'),
fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest },
mockAjax = new MockAjax(fakeGlobal);
const fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest');
const fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest };
const mockAjax = new MockAjax(fakeGlobal);
mockAjax.install();
@@ -1790,9 +1792,9 @@ describe("mockAjax", () => {
});
it("allows the httpRequest to be retrieved", () => {
const fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'),
fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest },
mockAjax = new MockAjax(fakeGlobal);
const fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest');
const fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest };
const mockAjax = new MockAjax(fakeGlobal);
mockAjax.install();
const request = new (<any> fakeGlobal.XMLHttpRequest)();
@@ -1802,9 +1804,9 @@ describe("mockAjax", () => {
});
it("allows the httpRequests to be cleared", () => {
const fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'),
fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest },
mockAjax = new MockAjax(fakeGlobal);
const fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest');
const fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest };
const mockAjax = new MockAjax(fakeGlobal);
mockAjax.install();
const request = new (<any> fakeGlobal.XMLHttpRequest)();
@@ -38,7 +38,7 @@ xall("A data driven test can be pending",
);
describe("A suite", () => {
var a: number;
let a: number;
beforeEach(() => {
a = 5;
@@ -50,4 +50,4 @@ describe("A suite", () => {
expect(a - b > 0).toBe(true);
}
);
});
});
+2 -2
View File
@@ -14,7 +14,7 @@ declare function affix(selector: string): JQuery;
interface JQuery {
/** Affixes the given jquery selectors into the element and will be removed after each spec
* @param {string} selector The JQuery selector to be added to the dom
*/
* @param {string} selector The JQuery selector to be added to the dom
*/
affix(selector: string): JQuery;
}
@@ -12,8 +12,8 @@ describe("Jasmine fixture extension", () => {
it("Inserts subelements when given", () => {
affix('#test2 .something-special');
expect('.something-special').toExist();
var parent = $('#test2 .something-special').parent();
var id = parent.attr('id');
const parent = $('#test2 .something-special').parent();
const id = parent.attr('id');
expect(id).toBe('test2');
});
@@ -43,4 +43,4 @@ describe("Jasmine fixture extension", () => {
expect('#test3').not.toExist();
});
});
});
});
+3 -2
View File
@@ -30,7 +30,8 @@ declare namespace JQueryToastmessage {
/** in effect duration in miliseconds @default 600 */
inEffectDuration?: number;
/**
* time in miliseconds before the item has to disappear @default 3000 */
* time in miliseconds before the item has to disappear @default 3000
*/
stayTime?: number;
/** content of the item @default '' */
text?: string;
@@ -52,6 +53,6 @@ declare namespace JQueryToastmessage {
*/
closeText?: string;
/** callback function when the toastmessage is closed @default null */
close?: () => void;
close?(): void;
}
}
+4 -4
View File
@@ -122,13 +122,13 @@ declare namespace JQueryTools {
* before the overlay is displayed. The overlay has already been positioned at the
* location from where it will start animating.
*/
onBeforeLoad?: (this: Overlay, event: JQueryEventObject) => void;
onBeforeLoad?(this: Overlay, event: JQueryEventObject): void;
/** when the overlay has completely been displayed */
onLoad?: (this: Overlay, event: JQueryEventObject) => void;
onLoad?(this: Overlay, event: JQueryEventObject): void;
/** before the overlay is closed */
onBeforeClose?: (this: Overlay, event: JQueryEventObject) => void;
onBeforeClose?(this: Overlay, event: JQueryEventObject): void;
/** when the overlay is closed */
onClose?: (this: Overlay, event: JQueryEventObject) => void;
onClose?(this: Overlay, event: JQueryEventObject): void;
}
interface MaskOptions {
+85 -90
View File
@@ -1,33 +1,31 @@
/* from documentation at http://jquerytools.github.io/documentation/overlay/index.html */
$("img[rel]").overlay();
$("img[rel]").overlay();
const triggers = $(".modalInput").overlay({
 
// some mask tweaks suitable for modal dialogs
mask: {
const triggers = $(".modalInput").overlay({
// some mask tweaks suitable for modal dialogs
mask: {
color: '#ebecff',
loadSpeed: 200,
opacity: 0.9
},
 
closeOnClick: false
});
},
const buttons = $("#yesno button").click(function(this: JQuery, e: JQueryEventObject) {
 
// get user input
const yes = buttons.index(this) === 0;
 
// do something with the answer
triggers.eq(0).html("You clicked " + (yes ? "yes" : "no"));
});
closeOnClick: false
});
const buttons = $("#yesno button").click(function(this: JQuery, e: JQueryEventObject) {
// get user input
const yes = buttons.index(this) === 0;
// do something with the answer
triggers.eq(0).html("You clicked " + (yes ? "yes" : "no"));
});
// select one or more elements to be overlay triggers
$(".my_overlay_trigger").overlay({
// one configuration property
mask: {
color: '#ccc'
color: '#ccc'
},
// another property
top: 50
@@ -35,44 +33,44 @@ $(".my_overlay_trigger").overlay({
});
$("#prompt form").submit(function(this: JQuery, e: JQueryEventObject) {
 
// close the overlay
triggers.eq(1).overlay<JQueryTools.overlay.Overlay>().close();
// or more straightforward:
triggers.data('overlay').close();
 
// get user input
const input = $("input", this).val();
 
// do something with the answer
triggers.eq(1).html(input);
 
// do not submit the form
return e.preventDefault();
});
// close the overlay
triggers.eq(1).overlay<JQueryTools.overlay.Overlay>().close();
// or more straightforward:
triggers.data('overlay').close();
// get user input
const input = $("input", this).val();
// do something with the answer
triggers.eq(1).html(input);
// do not submit the form
return e.preventDefault();
});
$.tools.overlay.addEffect('', () => {}, () => {});
/* custom effects */
$.tools.overlay.addEffect("myEffect", function(position, done) {
/*
- 'this' variable is a reference to the overlay API
- here we use jQuery's fadeIn() method to perform the effect
*/
this.getOverlay().css(position).fadeIn(this.getConf().speed, done);
},
 
// close function
function(done) {
// fade out the overlay
this.getOverlay().fadeOut(this.getConf().closeSpeed, done);
}
$.tools.overlay.addEffect("myEffect",
function(position, done) {
/*
- 'this' variable is a reference to the overlay API
- here we use jQuery's fadeIn() method to perform the effect
*/
this.getOverlay().css(position).fadeIn(this.getConf().speed, done);
},
// close function
function(done) {
// fade out the overlay
this.getOverlay().fadeOut(this.getConf().closeSpeed, done);
}
);
$("#apple img[rel]").overlay({effect: 'apple'});
// select the overlay element - and "make it an overlay"
$("#facebox").overlay({
// select the overlay element - and "make it an overlay"
$("#facebox").overlay({
// custom top position
top: 260,
// some mask tweaks suitable for facebox-looking dialogs
@@ -91,22 +89,19 @@ $("#apple img[rel]").overlay({effect: 'apple'});
});
$(function() {
 
// if the function argument is given to overlay,
// it is assumed to be the onBeforeLoad event listener
$("a[rel]").overlay({
 
mask: 'darkred',
effect: 'apple',
 
onBeforeLoad() {
// grab wrapper element inside content
const wrap = this.getOverlay().find(".contentWrap");
 
// load the page specified in the trigger
wrap.load(this.getTrigger().attr("href"));
}
 
});
});
@@ -118,60 +113,60 @@ $(() => {
[400, 530],
[0, 20]
];
 
// setup triggers
$("button[rel]").each(function(this: JQuery, i: number) {
 
$(this).overlay({
 
// common configuration for each overlay
oneInstance: false,
closeOnClick: false,
 
// setup custom finish position
top: positions[i][0],
left: positions[i][1],
 
// use apple effect
effect: 'apple'
 
});
});
});
// loading animation
$.tools.overlay.addEffect("drop", function(css, done) {
 
// use Overlay API to gain access to crucial elements
const conf = this.getConf(),
overlay = this.getOverlay();
 
// determine initial position for the overlay
if (conf.fixed) {
css['position'] = 'fixed';
} else {
css['top'] += $(window).scrollTop();
css['left'] += $(window).scrollLeft();
css['position'] = 'absolute';
$.tools.overlay.addEffect("drop",
function(css, done) {
// use Overlay API to gain access to crucial elements
const conf = this.getConf();
const overlay = this.getOverlay();
// determine initial position for the overlay
if (conf.fixed) {
css['position'] = 'fixed';
} else {
css['top'] += $(window).scrollTop();
css['left'] += $(window).scrollLeft();
css['position'] = 'absolute';
}
// position the overlay and show it
overlay.css(css).show();
// begin animating with our custom easing
overlay.animate(
{ top: '+=55', opacity: 1, width: '+=20'}, 400, 'drop', done
);
/* closing animation */
},
function(done) {
this.getOverlay().animate(
{ top: '-=55', opacity: 0, width: '-=20' },
300,
'drop',
function(this: JQuery) {
$(this).hide();
done.call(null);
});
}
 
// position the overlay and show it
overlay.css(css).show();
 
// begin animating with our custom easing
overlay.animate(
{ top: '+=55', opacity: 1, width: '+=20'}, 400, 'drop', done
);
 
/* closing animation */
}, function(done) {
this.getOverlay().animate(
{ top: '-=55', opacity: 0, width: '-=20' }, 300, 'drop',
function(this: JQuery) {
$(this).hide();
done.call(null);
});
});
);
$("img[rel]").overlay({
effect: 'drop',
+6 -6
View File
@@ -11,7 +11,7 @@ interface Expect<T> {
toBeCloseTo(this: Expect<number>, x: number, sigFigs: number): void;
toThrow(this: Expect<() => void>, msg?: string): void;
toContain<U>(this: Expect<U[]>, x: U): void;
};
}
declare function expect<T>(x: T): Expect<T>;
declare function beforeEach(f: () => void): void;
declare function afterEach(f: () => void): void;
@@ -621,8 +621,8 @@ describe("js-quantities", () => {
});
it("should be cached", () => {
const qty = Qty("100 m"),
converted = qty.to("ft");
const qty = Qty("100 m");
const converted = qty.to("ft");
expect(qty.to("ft") === converted).toBe(true);
});
@@ -1389,9 +1389,9 @@ describe("js-quantities", () => {
describe("array of values", () => {
it("should be converted", () => {
const converter = Qty.swiftConverter("MPa", "bar"),
values = [250, 10, 15],
expected = [2500, 100, 150];
const converter = Qty.swiftConverter("MPa", "bar");
const values = [250, 10, 15];
const expected = [2500, 100, 150];
expect(converter(values)).toEqual(expected);
});
-3
View File
@@ -3,12 +3,9 @@
// Definitions by: Matt Frantz <https://github.com/mhfrantz/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function stringify(obj: any, opts?: stringify.Comparator | stringify.Options): string;
declare namespace stringify {
interface Element {
key: string;
value: any;
@@ -1,6 +1,6 @@
import stringify = require('json-stable-stringify');
var obj = { c: 8, b: [{z: 6, y: 5, x: 4}, 7], a: 3 };
const obj = { c: 8, b: [{z: 6, y: 5, x: 4}, 7], a: 3 };
{
console.log(stringify(obj));
@@ -8,7 +8,7 @@ var obj = { c: 8, b: [{z: 6, y: 5, x: 4}, 7], a: 3 };
{
// Second arg can be a stringify.Comparator function.
var s: string = stringify(obj, (a: stringify.Element, b: stringify.Element): number => a.key < b.key ? 1 : -1);
const s: string = stringify(obj, (a: stringify.Element, b: stringify.Element): number => a.key < b.key ? 1 : -1);
console.log(s);
}
@@ -17,20 +17,20 @@ var obj = { c: 8, b: [{z: 6, y: 5, x: 4}, 7], a: 3 };
function reverse(a: stringify.Element, b: stringify.Element): number {
return a.value < b.value ? 1 : -1;
}
var opts: stringify.Options = { cmp: reverse };
var s: string = stringify(obj, opts);
const opts: stringify.Options = { cmp: reverse };
const s: string = stringify(obj, opts);
console.log(s);
}
{
// Space can be a string.
var s: string = stringify(obj, { space: ' ' });
const s: string = stringify(obj, { space: ' ' });
console.log(s);
}
{
// Space can be an integer.
var s: string = stringify(obj, { space: 2 });
const s: string = stringify(obj, { space: 2 });
console.log(s);
}
@@ -42,6 +42,6 @@ var obj = { c: 8, b: [{z: 6, y: 5, x: 4}, 7], a: 3 };
}
return value;
}
var s: string = stringify(obj, { replacer: removeStrings });
const s: string = stringify(obj, { replacer: removeStrings });
console.log(s);
}
+43 -16
View File
@@ -543,8 +543,8 @@ declare class BotUser extends User {
parameters?: {
displayReasonText?: string;
transferDisplayType?: KnuddelTransferDisplayType;
onSuccess?: () => void;
onError?: (message: string) => void;
onSuccess?(): void;
onError?(message: string): void;
}): void;
}
@@ -1181,26 +1181,45 @@ declare class ExternalServerAccess {
* Macht einen GET-Request auf die übergebene URL und liefert den Inhalt zurück.
* Diese Methode ist eine Convenience-Methode für externalServerAccess.callURL().
*/
getURL(urlString: string, parameters?: { onSuccess?: (responseData: string, externalServerResponse: ExternalServerResponse) => void;
onFailure?: (responseData: string, externalServerResponse: ExternalServerResponse) => void; }): void;
getURL(
urlString: string,
parameters?: {
onSuccess?(responseData: string, externalServerResponse: ExternalServerResponse): void;
onFailure?(responseData: string, externalServerResponse: ExternalServerResponse): void;
}): void;
/**
* Macht einen POST-Request auf die übergebene URL und liefert den Inhalt zurück.
* Diese Methode ist eine Convenience-Methode für externalServerAccess.callURL().
*/
postURL(urlString: string, parameters?: { onSuccess?: (responseData: string, externalServerResponse: ExternalServerResponse) => void;
onFailure?: (responseData: string, externalServerResponse: ExternalServerResponse) => void; data?: Json; }): void;
postURL(
urlString: string,
parameters?: {
onSuccess?(responseData: string, externalServerResponse: ExternalServerResponse): void;
onFailure?(responseData: string, externalServerResponse: ExternalServerResponse): void;
data?: Json;
}): void;
/**
* Macht einen GET-Request auf die übergebene URL. Im Gegensatz zum GET-Request wird der Inhalt der Webseite wird nicht ausgelesen.
* Aus diesem Grund ist diese Methode schneller.
* Diese Methode ist eine Convenience-Methode für externalServerAccess.callURL().
*/
touchURL(urlString: string, parameters?: { onSuccess?: (responseData: string, externalServerResponse: ExternalServerResponse) => void;
onFailure?: (responseData: string, externalServerResponse: ExternalServerResponse) => void; }): void;
touchURL(
urlString: string,
parameters?: {
onSuccess?(responseData: string, externalServerResponse: ExternalServerResponse): void;
onFailure?(responseData: string, externalServerResponse: ExternalServerResponse): void;
}): void;
/**
* Macht einen Request auf die übergebene URL.
*/
callURL(urlString: string, parameters?: { onSuccess?: (responseData: string, externalServerResponse: ExternalServerResponse) => void;
onFailure?: (responseData: string, externalServerResponse: ExternalServerResponse) => void; method?: ("GET" | "POST"); data?: Json; }): void;
callURL(
urlString: string,
parameters?: {
onSuccess?(responseData: string, externalServerResponse: ExternalServerResponse): void;
onFailure?(responseData: string, externalServerResponse: ExternalServerResponse): void;
method?: ("GET" | "POST");
data?: Json;
}): void;
}
/**
@@ -1308,7 +1327,7 @@ declare class KnuddelAccount {
*
* <br ><br ><b>Hinweis:</b> Knuddel an einen Nutzer senden kannst du mit der Methode BotUser/transferKnuddel:method.
*/
use(knuddelAmount: KnuddelAmount, displayReasonText: string, parameters?: { transferReason?: string; onError?: (message: string) => void; onSuccess?: () => void; }): void;
use(knuddelAmount: KnuddelAmount, displayReasonText: string, parameters?: { transferReason?: string; onError?(message: string): void; onSuccess?(): void; }): void;
}
/**
@@ -1590,7 +1609,13 @@ declare class KnuddelsServer {
* Ist ein KnuddelPot 30 Minuten nach dem Erzeugen noch nicht gesealt,
* so wird vom Server automatisch ein KnuddelPot/refund:method ausgelöst.
*/
static createKnuddelPot(knuddelAmount: KnuddelAmount, params?: { payoutTimeoutMinutes?: number; shouldSealPot?: (pot: KnuddelPot) => boolean; onPotSealed?: (pot: KnuddelPot) => void; }): KnuddelPot;
static createKnuddelPot(
knuddelAmount: KnuddelAmount,
params?: {
payoutTimeoutMinutes?: number;
shouldSealPot?(pot: KnuddelPot): boolean;
onPotSealed?(pot: KnuddelPot): void;
}): KnuddelPot;
/**
* Liefert den KnuddelPot mit der angegeben id.
*/
@@ -2466,8 +2491,10 @@ declare class UserAccess {
*/
eachAccessibleUser(
callback: (user: User, index: number, accessibleUserCount: number, key?: string) => boolean,
parameters?: { onStart?: (accessibleUserCount: number, key?: string) => void;
onEnd?: (accessibleUserCount: number, key?: string) => void; }): void;
parameters?: {
onStart?(accessibleUserCount: number, key?: string): void;
onEnd?(accessibleUserCount: number, key?: string): void;
}): void;
}
/**
@@ -2589,8 +2616,8 @@ declare class UserPersistenceNumbers {
minimumValue?: number;
maximumValue?: number;
maximumCount?: number;
onStart?: (totalCount: number, key: string) => void;
onEnd?: (totalCount: number, key: string) => void;
onStart?(totalCount: number, key: string): void;
onEnd?(totalCount: number, key: string): void;
}): void;
/**
* Liefert alle keys, die für User in der Persistence
@@ -11,14 +11,14 @@ class Server implements App {
.forEach((user) => {
this.onUserJoined(user);
});
};
}
onUserJoined(user: User) {
const botNick = KnuddelsServer.getDefaultBotUser()
.getNick()
.escapeKCode();
user.sendPrivateMessage('Lust auf ne Runde Ziegenphobie? Mit nur _°BB>_h1 Knuddel|/appknuddel ' + botNick + '<°°°_ bist du dabei!');
};
}
onUserLeft(user: User) {
if (this.usersPlaying[user.getNick()] === 1) {
@@ -27,7 +27,7 @@ class Server implements App {
delete this.usersPlaying[user.getNick()];
}
};
}
onPrepareShutdown() {
if (!this.isShuttingDown) {
@@ -71,7 +71,7 @@ class Server implements App {
} else {
knuddelTransfer.accept();
}
};
}
onKnuddelReceived(user: User, receiver: User, knuddelAmount: KnuddelAmount) {
if (knuddelAmount.asNumber() === 1) {
@@ -80,7 +80,7 @@ class Server implements App {
} else {
user.sendPrivateMessage('Vielen Dank für die Einzahlung.');
}
};
}
onEventReceived(user: User, key: string, data: string) {
if (key === 'selectedEntry' && this.usersPlaying[user.getNick()] === 1) {
@@ -120,7 +120,7 @@ class Server implements App {
}, 4000);
}, 1500);
}
};
}
}
declare let App: Server; // tell the compiler that "App" will be available
+2 -2
View File
@@ -3,11 +3,11 @@ import compose = require('koa-compose');
const fn1: compose.Middleware<any> = (context: any, next: () => Promise<void>): Promise<any> =>
Promise
.resolve(console.log('in fn1'))
.then(() => next());
.then(next);
const fn2: compose.Middleware<any> = (context: any, next: () => Promise<void>): Promise<any> =>
Promise
.resolve(console.log('in fn2'))
.then(() => next());
.then(next);
const fn = compose([fn1, fn2]);
+8 -8
View File
@@ -9,24 +9,24 @@ declare const LinkifyIt: {
};
declare namespace LinkifyIt {
export interface FullRule {
validate: (text: string, pos: number, self: LinkifyIt) => number;
normalize?: (match: string) => string;
interface FullRule {
validate(text: string, pos: number, self: LinkifyIt): number;
normalize?(match: string): string;
}
export type Rule = string | RegExp | FullRule;
type Rule = string | RegExp | FullRule;
export interface SchemaRules {
interface SchemaRules {
[schema: string]: Rule;
}
export interface Options {
interface Options {
fuzzyLink?: boolean;
fuzzyIP?: boolean;
fuzzyEmail?: boolean;
}
export interface Match {
interface Match {
index: number;
lastIndex: number;
raw: string;
@@ -35,7 +35,7 @@ declare namespace LinkifyIt {
url: string;
}
export interface LinkifyIt {
interface LinkifyIt {
add(schema: string, rule: Rule): LinkifyIt;
match(text: string): Match[];
normalize(raw: string): string;
+1 -1
View File
@@ -1,6 +1,6 @@
import * as moment from 'moment';
var m = moment();
const m = moment();
m.round(5, 'seconds');
m.ceil(3, 'minutes');
m.floor(16, 'hours');
+10 -10
View File
@@ -10,16 +10,16 @@ const d = moment.tz("May 12th 2014 8PM", "MMM Do YYYY hA", true, "America/Toront
a.tz();
const num = 1367337600000,
arr = [2013, 5, 1],
str = "2013-12-01",
date = new Date(2013, 4, 1),
mo = moment([2013, 4, 1]),
obj = { year : 2013, month : 5, day : 1 },
format = "YYYY-MM-DD",
formats = ["YYYY-MM-DD", "YYYY/MM/DD"],
formatsIncludingSpecial = ["YYYY-MM-DD", moment.ISO_8601],
language = "en";
const num = 1367337600000;
const arr = [2013, 5, 1];
const str = "2013-12-01";
const date = new Date(2013, 4, 1);
const mo = moment([2013, 4, 1]);
const obj = { year : 2013, month : 5, day : 1 };
const format = "YYYY-MM-DD";
const formats = ["YYYY-MM-DD", "YYYY/MM/DD"];
const formatsIncludingSpecial = ["YYYY-MM-DD", moment.ISO_8601];
const language = "en";
moment.tz();
moment.tz("America/Los_Angeles");
-2
View File
@@ -14,7 +14,6 @@
declare function multimatch(paths: string[], patterns: string | string[], options?: multimatch.MultimatchOptions): string[];
declare namespace multimatch {
/**
* Options based on [minimatch](https://github.com/isaacs/minimatch#minimatchmatchlist-pattern-options)
*/
@@ -67,7 +66,6 @@ declare namespace multimatch {
*/
flipNegate?: boolean;
}
}
export = multimatch;
+1 -1
View File
@@ -7,4 +7,4 @@ import * as passport from "passport";
export class Strategy implements passport.Strategy {
authenticate: () => void;
}
}
-2
View File
@@ -38,7 +38,6 @@ export function highlightAll(async: boolean, callback?: (element: Element) => vo
*/
export function highlightElement(element: Element, async: boolean, callback?: (element: Element) => void): void;
/**
* Low-level function, only use if you know what youre doing. It accepts a string of text as input and the language
* definitions to use, and returns a string with the HTML produced.
@@ -144,7 +143,6 @@ interface LanguageDefinition {
}
interface Languages {
/** Get a defined language's definition */
[key: string]: LanguageDefinition;
+4 -4
View File
@@ -1,5 +1,5 @@
var element = document.createElement("code");
var callback = (element: Element) => console.log(element);
const element = document.createElement("code");
const callback = (element: Element) => console.log(element);
Prism.highlightElement(element, false, callback);
Prism.highlightElement(element, false);
@@ -10,8 +10,8 @@ const hookCallback: Prism.HookCallback = env => null;
Prism.hooks.add("before-highlightall", hookCallback);
Prism.hooks.add("future-hook", hookCallback);
var language = "js";
var tokens = Prism.tokenize("var n = 1;", Prism.languages[language]);
const language = "js";
const tokens = Prism.tokenize("var n = 1;", Prism.languages[language]);
(function visit(token: Prism.TokenNode): Prism.TokenNode {
if (typeof token === "string") {
return token;
+3
View File
@@ -1,10 +1,13 @@
{
"extends": "../tslint.json",
"rules": {
"align": false,
"ban-types": false,
"callable-types": false,
"interface-name": [false],
"jsdoc-format": false,
"no-empty-interface": false,
"semicolon": false,
"unified-signatures": false
}
}