Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

indent ternary

commit 602d9ee708e4a520ad6ee47b02b4a688407990ab 1 parent a6296d6
@douglascrockford authored
Showing with 19 additions and 19 deletions.
  1. +3 −3 monad.js
  2. +16 −16 vow.js
View
6 monad.js
@@ -1,6 +1,6 @@
// monad.js
// Douglas Crockford
-// 2015-02-24
+// 2015-05-02
// Public Domain
@@ -110,8 +110,8 @@ function MONAD(modifier) {
prototype[name] = function () {
var result = this.bind(func, arguments);
return result && result.is_monad === true
- ? result
- : unit(result);
+ ? result
+ : unit(result);
};
return unit;
};
View
32 vow.js
@@ -1,6 +1,6 @@
// vow.js
// Douglas Crockford
-// 2015-02-25
+// 2015-05-02
// Public Domain
@@ -47,39 +47,39 @@ var VOW = (function () {
// either the keepers queue or the breakers queue.
var queue = resolution === 'keep'
- ? keepers
- : breakers;
+ ? keepers
+ : breakers;
queue[queue.length] = typeof func !== 'function'
// If func is not a function, push the resolver so that the value passes to
// the next cascaded .when.
- ? vow[resolution]
+ ? vow[resolution]
// If the func is a function, push a function that calls func with a value.
// The result can be a promise, or not a promise, or an exception.
- : function (value) {
- try {
- var result = func(value);
+ : function (value) {
+ try {
+ var result = func(value);
// If the result is a promise, then register our resolver with that promise.
- if (result && result.is_promise === true) {
- result.when(vow.keep, vow.break);
+ if (result && result.is_promise === true) {
+ result.when(vow.keep, vow.break);
// But if it is not a promise, then use the result to resolve our promise.
- } else {
- vow.keep(result);
- }
+ } else {
+ vow.keep(result);
+ }
// But if func throws an exception, then break our promise.
- } catch (e) {
- vow.break(e);
- }
- };
+ } catch (e) {
+ vow.break(e);
+ }
+ };
}
function herald(state, value, queue) {
Please sign in to comment.
Something went wrong with that request. Please try again.