From 1bf81571fc8d572f49ee815736e3452ebfc11412 Mon Sep 17 00:00:00 2001 From: Brian Cavalier Date: Thu, 8 Nov 2012 12:51:20 -0500 Subject: [PATCH] Add/fix comments. Add jshintrc and editorconfig --- .editorconfig | 6 ++++++ .jshintrc | 29 +++++++++++++++++++++++++++++ avow.js | 6 +++--- 3 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 .editorconfig create mode 100644 .jshintrc diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..00d5871 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,6 @@ +root = true + +[*] +indent_style = tab +indent_size = 4 +end_of_line = LF \ No newline at end of file diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..ff83ec9 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,29 @@ +{ + "browser": true, + "node": true, + "es5": true, + + "predef": [ + "define", + "setImmediate" + ], + + "boss": true, + "curly": true, + "eqnull": true, + "expr": true, + "globalstrict": false, + "laxbreak": true, + "newcap": true, + "noarg": true, + "noempty": true, + "nonew": true, + "quotmark": "single", + "strict": false, + "trailing": true, + "undef": true, + "unused": true, + + "maxdepth": 3, + "maxcomplexity": 4 +} \ No newline at end of file diff --git a/avow.js b/avow.js index 7c493bb..b6aab7b 100644 --- a/avow.js +++ b/avow.js @@ -1,5 +1,4 @@ /* Copyright (c) 2012 Brian Cavalier */ -/*global define:true, setImmediate:true*/ (function(define) { define(function() { @@ -104,6 +103,7 @@ define(function() { // When the promise is fulfilled or rejected, call all pending handlers function applyAllPending(apply, value) { + // Already fulfilled or rejected, ignore silently if(!pending) { return; } @@ -128,12 +128,12 @@ define(function() { } } - // Call fulfilled handler and fulfill the next promise in the chain + // Call fulfilled handler and forward to the next promise in the chain function applyFulfill(val, onFulfilled, _, fulfillNext, rejectNext) { return apply(val, onFulfilled, fulfillNext, fulfillNext, rejectNext); } - // Call rejected handler and fulfill the next promise in the chain + // Call rejected handler and forward to the next promise in the chain function applyReject(val, _, onRejected, fulfillNext, rejectNext) { return apply(val, onRejected, rejectNext, fulfillNext, rejectNext); }