From 7a52ddeba2a68388b544f529d2d92104420f77b0 Mon Sep 17 00:00:00 2001 From: Shipwreckt Date: Fri, 31 Oct 2025 20:02:14 +0000 Subject: Changed from static to 11ty! --- node_modules/a-sync-waterfall/test.js | 77 +++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 node_modules/a-sync-waterfall/test.js (limited to 'node_modules/a-sync-waterfall/test.js') diff --git a/node_modules/a-sync-waterfall/test.js b/node_modules/a-sync-waterfall/test.js new file mode 100644 index 0000000..ebb5883 --- /dev/null +++ b/node_modules/a-sync-waterfall/test.js @@ -0,0 +1,77 @@ +"use strict"; +const waterfall = require('./index'); + +var generateSyncTask = function(index) { + return function (x){ + return function(cb){ + console.log(x); + cb(null); + }; + }(index); +}; + + +var generateAsyncTask = function(index) { + return function (x){ + return function(cb){ + setTimeout(function(){ + console.log(x); + cb(null); + }, 0); + }; + }(index); +}; + +var generateSyncTasks = function(count){ + var tasks = []; + for(var i=0; i .5 ? tasks.push(generateAsyncTask(i)) : tasks.push(generateSyncTask(i)) + } + return tasks; +} + +var done = function(){ + console.log('done'); +} + +var testSync = function(){ + waterfall(generateSyncTasks(10), done); + console.log('this text should be after waterfall'); + +}; + +var testAsync = function(){ + waterfall(generateAsyncTasks(5), done); + console.log('this text should be before waterfall'); +}; + +var testMixed = function(){ + waterfall(generateRandomTasks(20), done); +}; + + +console.log('testSync:'); +testSync(); + +// console.log('\ntestAsync: '); +// testAsync(); + +console.log('\ntestMixed: '); +testMixed(); \ No newline at end of file -- cgit v1.2.3