diff --git a/steed/steed-tests.ts b/steed/steed-tests.ts
index 685654cc52..dd89e4480b 100644
--- a/steed/steed-tests.ts
+++ b/steed/steed-tests.ts
@@ -1,6 +1,6 @@
///
-import steed = require('steed')
+import steed = require('steed');
declare var path: {
exists: (path: string, callback?: (error: Error, exists: boolean) => any) => void;
@@ -10,133 +10,133 @@ function funcStringCbErrBoolean(v: string, cb: (error: Error, res: boolean) => v
function callback() { }
steed.parallel([
- function () { },
- function () { }
+ () => {},
+ () => {}
], callback);
steed.series([
- function () { },
- function () { }
+ () => {},
+ () => {}
]);
var data: any[] = [];
function steedProcess(item: any, callback: (error: Error, result: any) => void) { }
-steed.map(data, steedProcess, function (error, results) {
+steed.map(data, steedProcess, (error, results) => {
console.log(results);
});
var openFiles = ['file1', 'file2'];
-var saveFile = function (file: string, cb: (error: Error) => void) { }
-steed.each(openFiles, saveFile, function (error: Error) { });
-steed.eachSeries(openFiles, saveFile, function (error: Error) { });
+var saveFile = (file: string, cb: (error: Error) => void) => {};
+steed.each(openFiles, saveFile, (error: Error) => {});
+steed.eachSeries(openFiles, saveFile, (error: Error) => {});
// Control Flow //
steed.series([
- function (callback) {
+ callback => {
callback(undefined, 'one');
},
- function (callback) {
+ callback => {
callback(undefined, 'two');
},
],
- function (error, results) { });
+ (error, results) => {});
steed.series([
- function (callback) {
+ callback => {
callback(undefined, 'one');
},
- function (callback) {
+ callback => {
callback(undefined, 'two');
},
],
- function (error, results) { });
+ (error, results) => {});
steed.series({
- one: function (callback) {
- setTimeout(function () {
+ one(callback) {
+ setTimeout(() => {
callback(undefined, 1);
}, 200);
},
- two: function (callback) {
- setTimeout(function () {
+ two(callback) {
+ setTimeout(() => {
callback(undefined, 2);
}, 100);
},
},
- function (error, results) { });
+ (error, results) => {});
steed.series({
- one: function (callback) {
- setTimeout(function () {
+ one(callback) {
+ setTimeout(() => {
callback(undefined, 1);
}, 200);
},
- two: function (callback) {
- setTimeout(function () {
+ two(callback) {
+ setTimeout(() => {
callback(undefined, 2);
}, 100);
},
},
- function (error, results) { });
+ (error, results) => {});
steed.parallel([
- function (callback) {
- setTimeout(function () {
+ callback => {
+ setTimeout(() => {
callback(undefined, 'one');
}, 200);
},
- function (callback) {
- setTimeout(function () {
+ callback => {
+ setTimeout(() => {
callback(undefined, 'two');
}, 100);
},
],
- function (error, results) { });
+ (error, results) => {});
steed.parallel([
- function (callback) {
- setTimeout(function () {
+ callback => {
+ setTimeout(() => {
callback(undefined, 'one');
}, 200);
},
- function (callback) {
- setTimeout(function () {
+ callback => {
+ setTimeout(() => {
callback(undefined, 'two');
}, 100);
},
],
- function (error, results) { });
+ (error, results) => {});
steed.parallel({
- one: function (callback) {
- setTimeout(function () {
+ one(callback) {
+ setTimeout(() => {
callback(undefined, 1);
}, 200);
},
- two: function (callback) {
- setTimeout(function () {
+ two(callback) {
+ setTimeout(() => {
callback(undefined, 2);
}, 100);
},
},
- function (error, results) { });
+ (error, results) => {});
steed.parallel({
- one: function (callback) {
- setTimeout(function () {
+ one(callback) {
+ setTimeout(() => {
callback(undefined, 1);
}, 200);
},
- two: function (callback) {
- setTimeout(function () {
+ two(callback) {
+ setTimeout(() => {
callback(undefined, 2);
}, 100);
},
},
- function (error, results) { });
+ (error, results) => {});
function whileFn(callback: any) {
count++;
@@ -147,100 +147,100 @@ function whileTest() { return count < 5; }
var count = 0;
steed.waterfall([
- function (callback: any) {
+ (callback: any) => {
callback(null, 'one', 'two');
},
- function (arg1: any, arg2: any, callback: any) {
+ (arg1: any, arg2: any, callback: any) => {
callback(null, 'three');
},
- function (arg1: any, callback: any) {
+ (arg1: any, callback: any) => {
callback(null, 'done');
}
-], function (error, result) { });
+], (error, result) => {});
-var q = steed.queue(function (task: any, callback: () => void) {
+var q = steed.queue((task: any, callback: () => void) => {
console.log('hello ' + task.name);
callback();
}, 2);
-q.drain = function () {
+q.drain = () => {
console.log('all items have been processed');
-}
+};
q.push({ name: 'foo' });
-q.push({ name: 'bar' }, function (err) {
+q.push({ name: 'bar' }, err => {
console.log('finished processing bar');
});
-q.push([{ name: 'baz' }, { name: 'bay' }, { name: 'bax' }], function (error: Error) {
+q.push([{ name: 'baz' }, { name: 'bay' }, { name: 'bax' }], (error: Error) => {
console.log('finished processing bar');
});
q.unshift({ name: 'foo' });
-q.unshift({ name: 'bar' }, function (err) {
+q.unshift({ name: 'bar' }, err => {
console.log('finished processing bar');
});
-q.unshift([{ name: 'baz' }, { name: 'bay' }, { name: 'bax' }], function (error: Error) {
+q.unshift([{ name: 'baz' }, { name: 'bay' }, { name: 'bax' }], (error: Error) => {
console.log('finished processing bar');
});
var qLength: number = q.length();
var qIsIdle: boolean = q.idle();
-q.saturated = function () {
+q.saturated = () => {
console.log('queue is saturated.');
-}
+};
-q.empty = function () {
+q.empty = () => {
console.log('queue is empty.');
-}
+};
-q.drain = function () {
+q.drain = () => {
console.log('queue was drained.');
-}
+};
q.pause();
q.resume();
q.kill();
// tests for strongly typed tasks
-var q2 = steed.queue(function (task: string, callback: () => void) {
+var q2 = steed.queue((task: string, callback: () => void) => {
console.log('Task: ' + task);
callback();
}, 1);
q2.push('task1');
-q2.push('task2', function (error) {
+q2.push('task2', error => {
console.log('Finished tasks');
});
-q2.push(['task3', 'task4', 'task5'], function (error: Error) {
+q2.push(['task3', 'task4', 'task5'], (error: Error) => {
console.log('Finished tasks');
});
q2.unshift('task1');
-q2.unshift('task2', function (error) {
+q2.unshift('task2', error => {
console.log('Finished tasks');
});
-q2.unshift(['task3', 'task4', 'task5'], function (error: Error) {
+q2.unshift(['task3', 'task4', 'task5'], (error: Error) => {
console.log('Finished tasks');
});
steed.parallel([
- function (callback: (error: Error, val: string) => void) { },
- function (callback) { }
+ (callback: (error: Error, val: string) => void) => { },
+ callback => {}
],
- function (error: Error, results: Array) {
+ (error: Error, results: string[]) => {
steed.series([
- function (callback) { },
+ callback => { },
function email_link(callback) { }
]);
});
@@ -248,11 +248,11 @@ steed.parallel([
// each
steed.each({
- "a": 1,
- "b": 2
-}, function (val: number, next: steed.ErrorCallback): void {
+ a: 1,
+ b: 2
+}, (val: number, next: steed.ErrorCallback): void => {
- setTimeout(function (): void {
+ setTimeout((): void => {
console.log(`steed.each: ${val}`);
@@ -260,18 +260,18 @@ steed.each({
}, 500);
-}, function (err?: Error): void {
+}, (err?: Error): void => {
console.log("steed.each: done.");
});
steed.eachSeries({
- "a": 1,
- "b": 2
-}, function (val: number, next: steed.ErrorCallback): void {
+ a: 1,
+ b: 2
+}, (val: number, next: steed.ErrorCallback): void => {
- setTimeout(function (): void {
+ setTimeout((): void => {
console.log(`steed.eachSeries: ${val}`);
@@ -279,7 +279,7 @@ steed.eachSeries({
}, 500);
-}, function (err?: Error): void {
+}, (err?: Error): void => {
console.log("steed.eachSeries: done.");
@@ -288,12 +288,12 @@ steed.eachSeries({
// map
steed.map({
- "a": 1,
- "b": 2,
- "c": 3
-}, function (val: number, next: steed.SteedResultCallback): void {
+ a: 1,
+ b: 2,
+ c: 3
+}, (val: number, next: steed.SteedResultCallback): void => {
- setTimeout(function (): void {
+ setTimeout((): void => {
console.log(`steed.map: ${val}`);
@@ -301,19 +301,19 @@ steed.map({
}, 500);
-}, function (error: Error, results: string[]): void {
+}, (error: Error, results: string[]): void => {
console.log("steed.map: done with results", results);
});
steed.mapSeries({
- "a": 1,
- "b": 2,
- "c": 3
-}, function (val: number, next: steed.SteedResultCallback): void {
+ a: 1,
+ b: 2,
+ c: 3
+}, (val: number, next: steed.SteedResultCallback): void => {
- setTimeout(function (): void {
+ setTimeout((): void => {
console.log(`steed.mapSeries: ${val}`);
@@ -321,8 +321,8 @@ steed.mapSeries({
}, 500);
-}, function (error: Error, results: string[]): void {
+}, (error: Error, results: string[]): void => {
console.log("steed.mapSeries: done with results", results);
-});
\ No newline at end of file
+});
diff --git a/steed/tslint.json b/steed/tslint.json
index f05741c59b..0f47deabb4 100644
--- a/steed/tslint.json
+++ b/steed/tslint.json
@@ -3,4 +3,4 @@
"rules": {
"forbidden-types": false
}
-}
+}
\ No newline at end of file