Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial commit

  • Loading branch information...
commit a309b6df0f41536d579762ed33c2b17284678c57 0 parents
@serby serby authored
35 .gitignore
@@ -0,0 +1,35 @@
+# Node.js with Express and Stlyus
+public/css/*.css
+public/css/main/*.css
+public/css/admin/*.css
+/.monitor
+
+# Eclipse
+/.project
+/.settings
+/.buildpath
+
+# Windows
+Thumbs.db
+
+# Vim
+.*.sw[a-z]
+*.un~i
+tags
+
+# OsX
+.DS_Store
+Icon?
+._*
+.Spotlight-V100
+.Trashes
+
+# nodejs npm modules
+/node_modules
+
+# node-cluster
+/pids
+*.sock
+
+# ZSH Cake plugin cache
+/.cake_task_cache
4 .travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+ - 0.4
+ - 0.6
12 Makefile
@@ -0,0 +1,12 @@
+test:
+ @./node_modules/.bin/mocha \
+ -r should \
+ -R spec
+
+lint-changed:
+ @jshint `git status --porcelain | sed -e "s/^...//g"`
+
+lint:
+ @jshint lib test
+
+.PHONY: test lint lint-changed
15 README.md
@@ -0,0 +1,15 @@
+# jangle
+
+[![build status](https://secure.travis-ci.org/serby/jangle.png)](http://travis-ci.org/serby/jangle)
+
+## Installation
+
+ npm install jangle
+
+## Usage
+
+## Credits
+[Paul Serby](https://github.com/serby/)
+
+## Licence
+Licenced under the [New BSD License](http://opensource.org/licenses/bsd-license.php)
56 lib/jangle.js
@@ -0,0 +1,56 @@
+var async = require('async');
+
+module.exports.chain = function () {
+ var
+ responseArgs,
+ errored = false,
+ links = [],
+ detectFn;
+
+ var self = {
+ link: function() {
+ var
+ args = Array.prototype.slice.call(arguments),
+ fn = args.shift();
+
+ links.push(function(callback) {
+ args.push(callback);
+ fn.apply(fn, args);
+ });
+
+ return self;
+ },
+ detect: function(fn) {
+ detectFn = function(error) {
+ if (error || fn.apply(fn, arguments)) {
+ responseArgs = Array.prototype.slice.call(arguments);
+ }
+ };
+ return self;
+ },
+ error: function(fn) {
+ var error = [responseArgs ? responseArgs.shift() : null];
+ if (error[0]) {
+ fn.apply(fn, error);
+ errored = true;
+ }
+ return self;
+ },
+ run: function(fn) {
+ async.forEachSeries(links, function(linkFn, done) {
+
+ linkFn.bind(linkFn, function() {
+ detectFn.apply(detectFn, arguments);
+ done();
+ })();
+
+ }, function() {
+ if (!errored) {
+ fn.apply(fn, responseArgs);
+ }
+ });
+ }
+ };
+
+ return self;
+};
21 package.json
@@ -0,0 +1,21 @@
+{
+ "author": "Paul Serby <paul@serby.net>",
+ "name": "jangle",
+ "description": "",
+ "version": "0.0.1",
+ "repository": {
+ "type": "git",
+ "url": "git@github.com:serby/jangle"
+ },
+ "main": "lib/jangle.js",
+ "scripts": {
+ "test": "mocha -r should -R List "
+ },
+ "engines": {
+ "node": ">0.4.0"
+ },
+ "dependencies": {
+ "async": "~0.1"
+ },
+ "devDependencies": {}
+}
Please sign in to comment.
Something went wrong with that request. Please try again.