summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitmodules6
-rw-r--r--Makefile21
m---------deps/nodeunit0
-rw-r--r--dist/async.min.js1
-rw-r--r--nodelint.cfg4
-rwxr-xr-xtest.js22
-rw-r--r--test/test-async.js2
7 files changed, 33 insertions, 23 deletions
diff --git a/.gitmodules b/.gitmodules
index 3b65532..a9aae98 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,9 @@
[submodule "deps/nodeunit"]
path = deps/nodeunit
url = git://github.com/caolan/nodeunit.git
+[submodule "deps/UglifyJS"]
+ path = deps/UglifyJS
+ url = https://github.com/mishoo/UglifyJS.git
+[submodule "deps/nodelint"]
+ path = deps/nodelint
+ url = https://github.com/tav/nodelint.git
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..00f07ea
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,21 @@
+PACKAGE = asyncjs
+NODEJS = $(if $(shell test -f /usr/bin/nodejs && echo "true"),nodejs,node)
+
+BUILDDIR = dist
+
+all: build
+
+build: $(wildcard lib/*.js)
+ mkdir -p $(BUILDDIR)
+ uglifyjs lib/async.js > $(BUILDDIR)/async.min.js
+
+test:
+ nodeunit test
+
+clean:
+ rm -rf $(BUILDDIR)
+
+lint:
+ nodelint --config nodelint.cfg lib/async.js
+
+.PHONY: test build all
diff --git a/deps/nodeunit b/deps/nodeunit
deleted file mode 160000
-Subproject faacb5b53217edcdb3015c9e09a29539843e1ef
diff --git a/dist/async.min.js b/dist/async.min.js
new file mode 100644
index 0000000..53d4459
--- /dev/null
+++ b/dist/async.min.js
@@ -0,0 +1 @@
+/*global setTimeout: false, console: false */(function(){var a={};var b=this,c=b.async;typeof module!=="undefined"&&module.exports?module.exports=a:b.async=a,a.noConflict=function(){b.async=c;return a};var d=function(a,b){if(a.forEach)return a.forEach(b);for(var c=0;c<a.length;c+=1)b(a[c],c,a)};var e=function(a,b){if(a.map)return a.map(b);var c=[];d(a,function(a,d,e){c.push(b(a,d,e))});return c};var f=function(a,b,c){if(a.reduce)return a.reduce(b,c);d(a,function(a,d,e){c=b(c,a,d,e)});return c};var g=function(a){if(Object.keys)return Object.keys(a);var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b};var h=function(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0;c<a.length;c+=1)if(a[c]===b)return c;return-1};a.nextTick=function(a){typeof process==="undefined"||!process.nextTick?setTimeout(a,0):process.nextTick(a)},a.forEach=function(a,b,c){if(!a.length)return c();var e=0;d(a,function(d){b(d,function(b){b?(c(b),c=function(){}):(e+=1,e===a.length&&c())})})},a.forEachSeries=function(a,b,c){if(!a.length)return c();var d=0;var e=function(){b(a[d],function(b){b?(c(b),c=function(){}):(d+=1,d===a.length?c():e())})};e()};var i=function(b){return function(){var c=Array.prototype.slice.call(arguments);return b.apply(null,[a.forEach].concat(c))}};var j=function(b){return function(){var c=Array.prototype.slice.call(arguments);return b.apply(null,[a.forEachSeries].concat(c))}};var k=function(a,b,c,d){var f=[];b=e(b,function(a,b){return{index:b,value:a}}),a(b,function(a,b){c(a.value,function(c,d){f[a.index]=d,b(c)})},function(a){d(a,f)})};a.map=i(k),a.mapSeries=j(k),a.reduce=function(b,c,d,e){a.forEachSeries(b,function(a,b){d(c,a,function(a,d){c=d,b(a)})},function(a){e(a,c)})},a.inject=a.reduce,a.foldl=a.reduce,a.reduceRight=function(b,c,d,f){var g=e(b,function(a){return a}).reverse();a.reduce(g,c,d,f)},a.foldr=a.reduceRight;var l=function(a,b,c,d){var f=[];b=e(b,function(a,b){return{index:b,value:a}}),a(b,function(a,b){c(a.value,function(c){c&&f.push(a),b()})},function(a){d(e(f.sort(function(a,b){return a.index-b.index}),function(a){return a.value}))})};a.filter=i(l),a.filterSeries=j(l),a.select=a.filter,a.selectSeries=a.filterSeries;var m=function(a,b,c,d){var f=[];b=e(b,function(a,b){return{index:b,value:a}}),a(b,function(a,b){c(a.value,function(c){c||f.push(a),b()})},function(a){d(e(f.sort(function(a,b){return a.index-b.index}),function(a){return a.value}))})};a.reject=i(m),a.rejectSeries=j(m);var n=function(a,b,c,d){a(b,function(a,b){c(a,function(c){c?d(a):b()})},function(a){d()})};a.detect=i(n),a.detectSeries=j(n),a.some=function(b,c,d){a.forEach(b,function(a,b){c(a,function(a){a&&(d(true),d=function(){}),b()})},function(a){d(false)})},a.any=a.some,a.every=function(b,c,d){a.forEach(b,function(a,b){c(a,function(a){a||(d(false),d=function(){}),b()})},function(a){d(true)})},a.all=a.every,a.sortBy=function(b,c,d){a.map(b,function(a,b){c(a,function(c,d){c?b(c):b(null,{value:a,criteria:d})})},function(a,b){if(a)return d(a);var c=function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0};d(null,e(b.sort(c),function(a){return a.value}))})},a.auto=function(a,b){b=b||function(){};var c=g(a);if(!c.length)return b(null);var e=[];var i=[];var j=function(a){i.unshift(a)};var k=function(a){for(var b=0;b<i.length;b+=1)if(i[b]===a){i.splice(b,1);return}};var l=function(){d(i,function(a){a()})};j(function(){e.length===c.length&&b(null)}),d(c,function(c){var d=a[c]instanceof Function?[a[c]]:a[c];var g=function(a){a?(b(a),b=function(){}):(e.push(c),l())};var i=d.slice(0,Math.abs(d.length-1))||[];var m=function(){return f(i,function(a,b){return a&&h(e,b)!==-1},true)};if(m())d[d.length-1](g);else{var n=function(){m()&&(k(n),d[d.length-1](g))};j(n)}})},a.waterfall=function(b,c){if(!b.length)return c();c=c||function(){};var d=function(b){return function(e){if(e)c(e),c=function(){};else{var f=Array.prototype.slice.call(arguments,1);var g=b.next();g?f.push(d(g)):f.push(c),a.nextTick(function(){b.apply(null,f)})}}};d(a.iterator(b))()},a.parallel=function(b,c){c=c||function(){};if(b.constructor===Array)a.map(b,function(a,b){a&&a(function(a){var c=Array.prototype.slice.call(arguments,1);c.length<=1&&(c=c[0]),b.call(null,a,c||null)})},c);else{var d={};a.forEach(g(b),function(a,c){b[a](function(b){var e=Array.prototype.slice.call(arguments,1);e.length<=1&&(e=e[0]),d[a]=e,c(b)})},function(a){c(a,d)})}},a.series=function(b,c){c=c||function(){};if(b.constructor===Array)a.mapSeries(b,function(a,b){a&&a(function(a){var c=Array.prototype.slice.call(arguments,1);c.length<=1&&(c=c[0]),b.call(null,a,c||null)})},c);else{var d={};a.forEachSeries(g(b),function(a,c){b[a](function(b){var e=Array.prototype.slice.call(arguments,1);e.length<=1&&(e=e[0]),d[a]=e,c(b)})},function(a){c(a,d)})}},a.iterator=function(a){var b=function(c){var d=function(){a.length&&a[c].apply(null,arguments);return d.next()};d.next=function(){return c<a.length-1?b(c+1):null};return d};return b(0)},a.apply=function(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b.concat(Array.prototype.slice.call(arguments)))}};var o=function(a,b,c,d){var e=[];a(b,function(a,b){c(a,function(a,c){e=e.concat(c||[]),b(a)})},function(a){d(a,e)})};a.concat=i(o),a.concatSeries=j(o),a.whilst=function(b,c,d){b()?c(function(e){if(e)return d(e);a.whilst(b,c,d)}):d()},a.until=function(b,c,d){b()?d():c(function(e){if(e)return d(e);a.until(b,c,d)})},a.queue=function(b,c){var d=0;var e=[];var f={concurrency:c,push:function(b,c){e.push({data:b,callback:c}),a.nextTick(f.process)},process:function(){if(d<f.concurrency&&e.length){var a=e.splice(0,1)[0];d+=1,b(a.data,function(){d-=1,a.callback.apply(a,arguments),f.process()})}},length:function(){return e.length}};return f};var p=function(a){return function(b){var c=Array.prototype.slice.call(arguments,1);b.apply(null,c.concat([function(b){var c=Array.prototype.slice.call(arguments,1);typeof console!=="undefined"&&(b?console.error&&console.error(b):console[a]&&d(c,function(b){console[a](b)}))}]))}};a.log=p("log"),a.dir=p("dir")})() \ No newline at end of file
diff --git a/nodelint.cfg b/nodelint.cfg
new file mode 100644
index 0000000..457a967
--- /dev/null
+++ b/nodelint.cfg
@@ -0,0 +1,4 @@
+var options = {
+ indent: 4,
+ onevar: false
+};
diff --git a/test.js b/test.js
deleted file mode 100755
index 423cd0e..0000000
--- a/test.js
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/usr/local/bin/node
-
-require.paths.unshift(__dirname);
-require.paths.unshift(__dirname + '/deps');
-require.paths.unshift(__dirname + '/lib');
-
-try {
- var testrunner = require('nodeunit').testrunner;
-}
-catch(e) {
- var sys = require('sys');
- sys.puts("Cannot find nodeunit module.");
- sys.puts("You can download submodules for this project by doing:");
- sys.puts("");
- sys.puts(" git submodule init");
- sys.puts(" git submodule update");
- sys.puts("");
- process.exit();
-}
-
-process.chdir(__dirname);
-testrunner.run(['test']);
diff --git a/test/test-async.js b/test/test-async.js
index 7683c66..1c694b5 100644
--- a/test/test-async.js
+++ b/test/test-async.js
@@ -1,4 +1,4 @@
-var async = require('async');
+var async = require('../lib/async');
exports['auto'] = function(test){