mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-20 12:00:53 +08:00
Added typings for npm module each
* git: https://github.com/wdavidw/node-each
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
/// <reference path="each.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
function testEach() {
|
||||
var EachStaticClass: EachStatic = function (array: any[]) {
|
||||
return {
|
||||
paused: true,
|
||||
readable: false,
|
||||
started: true,
|
||||
done: true,
|
||||
total: true,
|
||||
on: function (eventName: string, cb: (a: any, b?: () => void) => void) {
|
||||
return EachStaticClass([]);
|
||||
},
|
||||
parallel: function (mode: any) {
|
||||
return EachStaticClass([]);
|
||||
},
|
||||
shift: function (items: any[]) {},
|
||||
write: function (items: any[]) {},
|
||||
unshift: function (items: any[]) {},
|
||||
end: function () {
|
||||
return EachStaticClass([]);
|
||||
},
|
||||
times: function () {
|
||||
return EachStaticClass([]);
|
||||
},
|
||||
repeat: function () {
|
||||
return EachStaticClass([]);
|
||||
},
|
||||
sync: function () {
|
||||
return EachStaticClass([]);
|
||||
},
|
||||
files: function (a: any, glob?: any) {}
|
||||
};
|
||||
};
|
||||
|
||||
var each: Each = EachStaticClass([1, 2, 3]);
|
||||
|
||||
var EachReq: EachStatic = require("each");
|
||||
var each: Each = EachReq([4, 5, 6]);
|
||||
}
|
||||
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
// Type definitions for NodeEach v0.4.9
|
||||
// Project: http://www.adaltas.com/projects/node-each/
|
||||
// Definitions by: Michael Zabka <https://github.com/misak113/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface Each {
|
||||
paused: boolean;
|
||||
readable: boolean;
|
||||
started: boolean;
|
||||
done: boolean;
|
||||
total: boolean;
|
||||
on(eventName: string, onCallback: Function): Each;
|
||||
on(eventName: "item", onItem: (item: any, next: (error?: Error) => void) => void): Each;
|
||||
on(eventName: "error", onError: (error: Error[]) => void): Each;
|
||||
on(eventName: "error", onError: (error: Error) => void): Each;
|
||||
on(eventName: "both", onBoth: (error?: Error[]) => void): Each;
|
||||
on(eventName: "end", onEnd: () => void): Each;
|
||||
parallel(mode: number): Each;
|
||||
parallel(mode: boolean): Each;
|
||||
shift(items: any[]): void;
|
||||
write(items: any[]): void;
|
||||
unshift(items: any[]): void;
|
||||
end(): Each;
|
||||
times(): Each;
|
||||
repeat(): Each;
|
||||
sync(): Each;
|
||||
files(glob: any): void;
|
||||
files(base: any, glob: any): void;
|
||||
}
|
||||
|
||||
interface EachStatic {
|
||||
(array: any[]): Each;
|
||||
}
|
||||
|
||||
declare var each: EachStatic;
|
||||
|
||||
declare module "each" {
|
||||
export = each;
|
||||
}
|
||||
Reference in New Issue
Block a user