This commit is contained in:
Andy Hanson
2017-02-21 14:48:55 -08:00
parent 5a9a4a4cfa
commit 82de68c128
17 changed files with 474 additions and 511 deletions
+9 -9
View File
@@ -1,4 +1,4 @@
// Type definitions for tcomb v1.0.3
// Type definitions for tcomb 1.0
// Project: http://gcanti.github.io/tcomb/guide/index.html
// Definitions by: Hans Windhoff <https://github.com/hansrwindhoff>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -26,14 +26,14 @@ declare namespace TComb {
Func: Func_Static;
func: {
(domain: TCombBase[], codomain: TCombBase, name?: string): Func_Static;
(domain: TCombBase, codomain: TCombBase, name?: string) : Func_Static;
}
(domain: TCombBase, codomain: TCombBase, name?: string): Func_Static;
};
Err: Err_Static;
Re: Re_Static;
Dat: Dat_Static;
Type: Type_Static;
irreducible: (name: string, is: TypePredicate) => TCombBase;
struct: (props: Object, name?: string) => Struct_Static;
irreducible(name: string, is: TypePredicate): TCombBase;
struct(props: Object, name?: string): Struct_Static;
Union: Union_Static;
Maybe: Maybe_Static;
@@ -43,15 +43,15 @@ declare namespace TComb {
maybe(type: TCombBase, name?: string): Maybe_Static;
Tuple: Tuple_Static;
tuple:(types: TCombBase[], name?: string)=> Tuple_Static;
tuple(types: TCombBase[], name?: string): Tuple_Static;
Subtype: Subtype_Static;
List: List_Static;
list:(type: TCombBase, name?: string)=> List_Static;
list(type: TCombBase, name?: string): List_Static;
Dict: Dict_Static;
dict:(domain: TCombBase, codomain: TCombBase, name?: string)=> Dict_Static;
dict(domain: TCombBase, codomain: TCombBase, name?: string): Dict_Static;
subtype(type: TCombBase, predicate: TypePredicate, name?: string): Subtype_Static;
@@ -260,7 +260,7 @@ declare namespace TComb {
* @param name - Useful for debugging purposes.
*/
export module enums {
export namespace enums {
/**
* @param keys - Array of enums.
* @param name - Useful for debugging purposes.
+368 -406
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -5,7 +5,7 @@
"es6"
],
"noImplicitAny": true,
"noImplicitThis": false,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
+10
View File
@@ -0,0 +1,10 @@
{
"extends": "../tslint.json",
"rules": {
"callable-types": false,
"forbidden-types": false,
"no-empty-interface": false,
"no-single-declare-module": false,
"unified-signatures": false
}
}
+2 -2
View File
@@ -2,7 +2,7 @@ function testDropdown() {
UIkit.dropdown("#parent");
UIkit.dropdown($("#parent"));
let options: UIkit.DropdownOptions = {
const options: UIkit.DropdownOptions = {
pos: 'bottom-center',
mode: 'click',
remaintime: 150,
@@ -24,7 +24,7 @@ function testDropdown() {
function testModal() {
UIkit.modal.alert("Attention!");
let options: UIkit.ModalOptions = {
const options: UIkit.ModalOptions = {
keyboard: true,
bgclose: true,
minScrollHeight: 150,
+1 -1
View File
@@ -1,4 +1,4 @@
import userHome = require('user-home');
console.log(userHome);
//=> '/Users/sindresorhus'
// => '/Users/sindresorhus'
+2 -5
View File
@@ -169,10 +169,7 @@ var edges = new vis.DataSet([
var container = <HTMLElement> document.getElementById('mynetwork');
// provide the data in the vis format
var data2 = {
nodes: nodes,
edges: edges
};
var data2 = { nodes, edges };
var options = {};
// initialize your network!
@@ -187,7 +184,7 @@ var options2 = {
configure: {
enabled: true,
filter: 'nodes,edges',
container: container,
container,
showButton: true
}
};
+9 -9
View File
@@ -14,9 +14,9 @@ import VKBeautify from 'vkbeautify';
* String: character string to visualize indentation ( can also be a set of white spaces )
*/
let exampleContent = "here-be-xml-json-css-or-sql-content-that-is-about-to-get-formatted";
const exampleContent = "here-be-xml-json-css-or-sql-content-that-is-about-to-get-formatted";
//xml
// xml
function xmlWithDefault() {
VKBeautify.xml(exampleContent);
}
@@ -29,7 +29,7 @@ function xmlWithStringPattern() {
VKBeautify.xml(exampleContent, ' ');
}
//json
// json
function jsonWithDefault() {
VKBeautify.json(exampleContent);
}
@@ -42,7 +42,7 @@ function jsonWithStringPattern() {
VKBeautify.json(exampleContent, ' ');
}
//css
// css
function cssWithDefault() {
VKBeautify.css(exampleContent);
}
@@ -55,7 +55,7 @@ function cssWithStringPattern() {
VKBeautify.css(exampleContent, ' ');
}
//sql
// sql
function sqlWithDefault() {
VKBeautify.sql(exampleContent);
}
@@ -82,7 +82,7 @@ function sqlWithStringPattern() {
* Set this flag to true to prevent removing comments from @text ( minxml and mincss functions only. )
*/
//xml
// xml
function xmlminWithDefault() {
VKBeautify.xmlmin(exampleContent);
}
@@ -95,12 +95,12 @@ function xmlminAndRemoveComments() {
VKBeautify.xmlmin(exampleContent, false);
}
//json
// json
function jsonmin() {
VKBeautify.jsonmin(exampleContent);
}
//css
// css
function cssminWithDefault() {
VKBeautify.cssmin(exampleContent);
}
@@ -113,7 +113,7 @@ function cssminAndRemoveComments() {
VKBeautify.cssmin(exampleContent, false);
}
//sql
// sql
function sqlmin() {
VKBeautify.sqlmin(exampleContent);
}
+26 -26
View File
@@ -1,4 +1,4 @@
// Type definitions for Web MIDI API
// Type definitions for Web MIDI API 2.0
// Project: http://www.w3.org/TR/webmidi/
// Definitions by: six a <https://github.com/lostfictions>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -8,7 +8,7 @@ interface Navigator {
* When invoked, returns a Promise object representing a request for access to MIDI
* devices on the user's system.
*/
requestMIDIAccess(options?: WebMidi.MIDIOptions) : Promise<WebMidi.MIDIAccess>;
requestMIDIAccess(options?: WebMidi.MIDIOptions): Promise<WebMidi.MIDIAccess>;
}
declare namespace WebMidi {
@@ -17,7 +17,7 @@ declare namespace WebMidi {
* This member informs the system whether the ability to send and receive system
* exclusive messages is requested or allowed on a given MIDIAccess object.
*/
sysex : boolean;
sysex: boolean;
}
/**
@@ -36,24 +36,24 @@ declare namespace WebMidi {
/**
* The MIDI input ports available to the system.
*/
inputs : MIDIInputMap;
inputs: MIDIInputMap;
/**
* The MIDI output ports available to the system.
*/
outputs : MIDIOutputMap;
outputs: MIDIOutputMap;
/**
* The handler called when a new port is connected or an existing port changes the
* state attribute.
*/
onstatechange : (e : MIDIConnectionEvent) => void;
onstatechange: (e: MIDIConnectionEvent) => void;
/**
* This attribute informs the user whether system exclusive support is enabled on
* this MIDIAccess.
*/
sysexEnabled : boolean;
sysexEnabled: boolean;
}
export type MIDIPortType = "input" | "output";
@@ -67,44 +67,44 @@ declare namespace WebMidi {
* A unique ID of the port. This can be used by developers to remember ports the
* user has chosen for their application.
*/
id : string;
id: string;
/**
* The manufacturer of the port.
*/
manufacturer? : string;
manufacturer?: string;
/**
* The system name of the port.
*/
name? : string;
name?: string;
/**
* A descriptor property to distinguish whether the port is an input or an output
* port.
*/
type : MIDIPortType;
type: MIDIPortType;
/**
* The version of the port.
*/
version? : string;
version?: string;
/**
* The state of the device.
*/
state : MIDIPortDeviceState;
state: MIDIPortDeviceState;
/**
* The state of the connection to the device.
*/
connection : MIDIPortConnectionState;
connection: MIDIPortConnectionState;
/**
* The handler called when an existing port changes its state or connection
* attributes.
*/
onstatechange : (e : MIDIConnectionEvent) => void;
onstatechange: (e: MIDIConnectionEvent) => void;
/**
* Makes the MIDI device corresponding to the MIDIPort explicitly available. Note
@@ -115,7 +115,7 @@ declare namespace WebMidi {
* When invoked, this method returns a Promise object representing a request for
* access to the given MIDI port on the user's system.
*/
open() : Promise<MIDIPort>;
open(): Promise<MIDIPort>;
/**
* Makes the MIDI device corresponding to the MIDIPort
@@ -130,11 +130,11 @@ declare namespace WebMidi {
* other applications), the vended Promise is resolved. If the port is
* disconnected, the Promise is rejected.
*/
close() : Promise<MIDIPort>;
close(): Promise<MIDIPort>;
}
export interface MIDIInput extends MIDIPort {
onmidimessage : (e : MIDIMessageEvent) => void;
onmidimessage: (e: MIDIMessageEvent) => void;
}
export interface MIDIOutput extends MIDIPort {
@@ -145,7 +145,7 @@ declare namespace WebMidi {
* to zero (or another time in the past), the data is to be sent as soon as
* possible.
*/
send(data : number[], timestamp? : number) : void;
send(data: number[], timestamp?: number): void;
/**
* Clears any pending send data that has not yet been sent from the MIDIOutput 's
@@ -153,44 +153,44 @@ declare namespace WebMidi {
* state, so if the output port is in the middle of a sysex message, a sysex
* termination byte (0xf7) should be sent.
*/
clear() : void;
clear(): void;
}
export interface MIDIMessageEvent extends Event {
/**
* A timestamp specifying when the event occurred.
*/
receivedTime : number;
receivedTime: number;
/**
* A Uint8Array containing the MIDI data bytes of a single MIDI message.
*/
data : Uint8Array;
data: Uint8Array;
}
export interface MIDIMessageEventInit extends EventInit {
/**
* A timestamp specifying when the event occurred.
*/
receivedTime : number;
receivedTime: number;
/**
* A Uint8Array containing the MIDI data bytes of a single MIDI message.
*/
data : Uint8Array;
data: Uint8Array;
}
export interface MIDIConnectionEvent extends Event {
/**
* The port that has been connected or disconnected.
*/
port : MIDIPort;
port: MIDIPort;
}
export interface MIDIConnectionEventInit extends EventInit {
/**
* The port that has been connected or disconnected.
*/
port : MIDIPort;
port: MIDIPort;
}
}
+1
View File
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"lib": [
"es6",
"dom"
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }
+7 -7
View File
@@ -3,7 +3,7 @@
var onFulfilled = (item: WebMidi.MIDIAccess) => {
this._midiPort = item;
item.onstatechange = (event : WebMidi.MIDIConnectionEvent) => {
item.onstatechange = (event: WebMidi.MIDIConnectionEvent) => {
console.log("onstatechange");
console.log(event);
};
@@ -11,27 +11,27 @@ var onFulfilled = (item: WebMidi.MIDIAccess) => {
console.log("sysexenabled");
console.log(item.sysexEnabled);
var inputs = this._midiPort.inputs.values();
var inputs = this._midiPort.inputs.values();
for(const o of inputs){
for (const o of inputs) {
this._inputs.push(o);
console.log(o);
}
var outputs = item.outputs.values();
for(const op of outputs){
for (const op of outputs) {
this._outputs.push(op);
op.send([ 0x90, 0x45, 0x7f ] );
}
for(var cnt = 0; cnt < this._inputs.length; cnt++){
this._inputs[cnt].onmidimessage = (event: WebMidi.MIDIMessageEvent)=>{
for (const input of this._inputs) {
input.onmidimessage = (event: WebMidi.MIDIMessageEvent) => {
this.onMidiMessage(event.data);
};
}
};
var onRejected = (e: Error)=>{ console.error(e) };
var onRejected = (e: Error) => { console.error(e); };
if (navigator.requestMIDIAccess !== undefined) {
navigator.requestMIDIAccess().then(onFulfilled, onRejected);
+11 -21
View File
@@ -1,4 +1,4 @@
// Type definitions for wu.js v2.1.0
// Type definitions for wu.js 2.1
// Project: https://fitzgen.github.io/wu.js/
// Definitions by: phiresky <https://github.com/phiresky/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -10,7 +10,7 @@ declare namespace Wu {
export interface WuStatic {
<T>(iterable: Iterable<T>): WuIterable<T>;
// only static
chain<T>(...iters: Iterable<T>[]): WuIterable<T>;
chain<T>(...iters: Array<Iterable<T>>): WuIterable<T>;
count(start?: number, step?: number): WuIterable<number>;
curryable<T>(fun: (...x: any[]) => T, expected?: number): any;
entries<T>(obj: { [i: string]: T }): WuIterable<[string, T]>;
@@ -24,7 +24,6 @@ declare namespace Wu {
cycle<T>(iter: Iterable<T>): Iterable<T>;
chunk<T>(n: number, iter: Iterable<T>): WuIterable<T[]>;
concatMap<T, U>(fn: (t: T) => Iterable<U>, iter: Iterable<T>): WuIterable<U>;
dropWhile<T>(fn: Filter<T>, iter: Iterable<T>): WuIterable<T>;
enumerate<T>(iter: Iterable<T>): Iterable<[number, T]>;
every<T>(fn: Filter<T>, iter: Iterable<T>): boolean;
filter<T>(fn: Filter<T>, iter: Iterable<T>): WuIterable<T>;
@@ -60,8 +59,8 @@ declare namespace Wu {
zipLongest<T, U>(iter2: Iterable<T>, iter: Iterable<U>): WuIterable<[T, U]>;
zipWith: any;
unzip: any;
tee<T>(iter: Iterable<T>): WuIterable<T>[];
tee<T>(n: number, iter: Iterable<T>): WuIterable<T>[];
tee<T>(iter: Iterable<T>): Array<WuIterable<T>>;
tee<T>(n: number, iter: Iterable<T>): Array<WuIterable<T>>;
}
export interface WuIterable<T> extends IterableIterator<T> {
// generated from section "copied to WuIterable" above via
@@ -74,13 +73,11 @@ declare namespace Wu {
cycle(): Iterable<T>;
chunk(n: number): WuIterable<T[]>;
concatMap<U>(fn: (t: T) => Iterable<U>): WuIterable<U>;
dropWhile(fn: Filter<T>): WuIterable<T>;
enumerate(): Iterable<[number, T]>;
every(fn: Filter<T>): boolean;
filter(fn: Filter<T>): WuIterable<T>;
find(fn: Filter<T>): T;
flatten(): WuIterable<any>;
flatten(shallow: boolean): WuIterable<any>;
flatten(shallow?: boolean): WuIterable<any>;
forEach(fn: Consumer<T>): void;
has(t: T): boolean;
// invoke<T, U>(name:string, ...t:T[], iter: Iterable<(t:T)=>U>): WuIterable<U>;
@@ -88,18 +85,12 @@ declare namespace Wu {
map<U>(fn: (t: T) => U): WuIterable<U>;
// pluck<T>(attribute:string, iter: Iterable<{[attribute]: T}>): WuIterable<T>;
pluck(attribute: string): WuIterable<any>;
reduce(fn: (a: T, b: T) => T): T;
reduce(fn: (a: T, b: T) => T, initial: T): T;
reduce<U>(fn: (a: U, b: T) => U): U;
reduce<U>(fn: (a: U, b: T) => U, initial: U): U;
reductions(fn: (a: T, b: T) => T): WuIterable<T>;
reductions(fn: (a: T, b: T) => T, initial: T): WuIterable<T>;
reductions<U>(fn: (a: U, b: T) => U): WuIterable<U>;
reductions<U>(fn: (a: U, b: T) => U, initial: U): WuIterable<U>;
reduce(fn: (a: T, b: T) => T, initial?: T): T;
reduce<U>(fn: (a: U, b: T) => U, initial?: U): U;
reductions(fn: (a: T, b: T) => T, initial?: T): WuIterable<T>;
reductions<U>(fn: (a: U, b: T) => U, initial?: U): WuIterable<U>;
reject(fn: Filter<T>): WuIterable<T>;
slice(): WuIterable<T>;
slice(start: number): WuIterable<T>;
slice(start: number, stop: number): WuIterable<T>;
slice(start?: number, stop?: number): WuIterable<T>;
some(fn: Filter<T>): boolean;
spreadMap(fn: (...x: any[]) => T, iter: Iterable<any[]>): WuIterable<T>;
take(n: number): WuIterable<T>;
@@ -110,8 +101,7 @@ declare namespace Wu {
zipLongest<U>(iter2: Iterable<T>): WuIterable<[T, U]>;
zipWith: any;
unzip: any;
tee(): WuIterable<T>[];
tee(n: number): WuIterable<T>[];
tee(n?: number): Array<WuIterable<T>>;
}
}
declare var wu: Wu.WuStatic;
+1
View File
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"lib": [
"es6"
],
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }
+23 -23
View File
@@ -1,13 +1,13 @@
// adapted from `cat wu.js/test/* |sed '/= require/d'> wu-tests.ts`
declare var describe: any, it: any, mocha: any, assert: {
iterable:any;
eqSet<T>(expected:Set<T>, actual: Iterable<T>): any;
ok:any;
equal<T>(x:T, y:T): any;
eqArray<T>(x:T[], y:Iterable<T>): any;
deepEqual<T>(x:T, y:T): any;
}
iterable: any;
eqSet<T>(expected: Set<T>, actual: Iterable<T>): any;
ok: any;
equal<T>(x: T, y: T): any;
eqArray<T>(x: T[], y: Iterable<T>): any;
deepEqual<T>(x: T, y: T): any;
};
// Helper for asserting that the given thing is iterable.
assert.iterable = (thing: any) => {
@@ -59,8 +59,8 @@ describe("wu.chain", () => {
});
describe("wu.chunk", () => {
it("should chunk items into tuples", () => {
assert.eqArray([[1,2,3], [4,5,6]],
wu.chunk(3, [1,2,3,4,5,6]));
assert.eqArray([[1, 2, 3], [4, 5, 6]],
wu.chunk(3, [1, 2, 3, 4, 5, 6]));
});
});
describe("wu.concatMap", () => {
@@ -121,7 +121,7 @@ describe("wu.cycle", () => {
it("should keep yielding items from the original iterable", () => {
let i = 0;
const arr = [1, 2, 3];
for (let x of wu.cycle(arr)) {
for (const x of wu.cycle(arr)) {
assert.equal(x, arr[i % 3]);
if (i++ > 9) {
break;
@@ -144,7 +144,7 @@ describe("wu.dropWhile", () => {
describe("wu.entries", () => {
it("should iterate over entries", () => {
const expected = new Map([["foo", 1], ["bar", 2], ["baz", 3]]);
for (let [k, v] of wu.entries({ foo: 1, bar: 2, baz: 3 })) {
for (const [k, v] of wu.entries({ foo: 1, bar: 2, baz: 3 })) {
assert.equal(expected.get(k), v);
}
});
@@ -183,7 +183,7 @@ describe("wu.find", () => {
it("should return undefined if no items match the predicate", () => {
assert.equal(undefined,
wu.find(x => (<any>x) === "raekwon",
wu.find(x => (<any> x) === "raekwon",
[{ name: "odb" },
{ name: "method man" },
{ name: "rza" },
@@ -204,25 +204,25 @@ describe("wu.flatten", () => {
describe("wu.forEach", () => {
it("should iterate over every item", () => {
const items: any[] = [];
wu.forEach(x => items.push(x), [1,2,3]);
assert.eqArray([1,2,3], items);
wu.forEach(x => items.push(x), [1, 2, 3]);
assert.eqArray([1, 2, 3], items);
});
});
describe("wu.has", () => {
it("should return true if the item is in the iterable", () => {
assert.ok(wu.has(3, [1,2,3]));
assert.ok(wu.has(3, [1, 2, 3]));
});
it("should return false if the item is not in the iterable", () => {
assert.ok(!wu.has(<any>"36 chambers", [1,2,3]));
assert.ok(!wu.has(<any> "36 chambers", [1, 2, 3]));
});
});
describe("wu.invoke", () => {
it("should yield the method invokation on each item", () => {
function Greeter(name: string) {
this.name = name
this.name = name;
}
Greeter.prototype.greet = function (tail: string) {
Greeter.prototype.greet = function(tail: string) {
return "hello " + this.name + tail;
};
assert.eqArray(["hello world!", "hello test!"],
@@ -250,11 +250,11 @@ describe("wu.pluck", () => {
});
describe("wu.reduce", () => {
it("should reduce the iterable with the function", () => {
assert.equal(6, wu([1,2,3]).reduce((x, y) => x + y));
assert.equal(6, wu([1, 2, 3]).reduce((x, y) => x + y));
});
it("should accept an initial state for the reducer function", () => {
assert.equal(16, wu.reduce((x, y) => x + y, 10, [1,2,3]));
assert.equal(16, wu.reduce((x, y) => x + y, 10, [1, 2, 3]));
});
});
describe("wu.reductions", () => {
@@ -305,11 +305,11 @@ describe("wu.slice", () => {
});
describe("wu.some", () => {
it("should return true if any item matches the predicate", () => {
assert.ok(wu.some(x => x % 2 === 0, [1,2,3]));
assert.ok(wu.some(x => x % 2 === 0, [1, 2, 3]));
});
it("should return false if no items match the predicate", () => {
assert.ok(!wu.some(x => x % 5 === 0, [1,2,3]));
assert.ok(!wu.some(x => x % 5 === 0, [1, 2, 3]));
});
});
describe("wu.spreadMap", () => {
@@ -357,7 +357,7 @@ describe("wu.tee", () => {
describe("wu.unique", () => {
it("should yield only the unique items from the iterable", () => {
assert.eqArray([1, 2, 3],
wu.unique([1,1,2,2,1,1,3,3]));
wu.unique([1, 1, 2, 2, 1, 1, 3, 3]));
});
});
describe("wu.unzip", () => {
+1 -1
View File
@@ -5,7 +5,7 @@ import { EventEmitter } from 'events';
class MyES2015Generator extends Base {}
const MyGenerator = Base.extend({
writing: function(this: Base): void {
writing(this: Base): void {
this.fs.write('var foo = 1;', this.destinationPath('index.js'));
}
});