Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // regular-style javascript
- function foo (a,b,c,d) {
- if (a > c) throw new Error("c must be teh greetest");
- return a * b * c * d;
- }
- function b (d,e) {
- if (e === d) throw new Error("must not be equal");
- return e - d;
- }
- function x (d) {
- return d ? b(1,2) : foo(1,2,3,4); // convert to d ? return x : return y then do return/throw conversion.
- }
- var bar = foo(1,2,3);
- print(bar);
- bar += 3;
- var c = b(4,5);
- print(c);
- print(b(1,x(false)));
- // continuated version
- function foo (a,b,c,d) { var ___callback___ = Array.prototype.pop.call(arguments)
- if (a > c) return ___callback___(new Error("c must be teh greetest"));
- return ___callback___(null, a * b * c * d);
- }
- function b (d,e) { var ___callback___ = Array.prototype.pop.call(arguments)
- if (e === d) return ___callback___(new Error("must not be equal"));
- return ___callback___(null, e - d);
- }
- function x (d) { var ___callback___ = Array.prototype.pop.call(arguments)
- d ? return b(1,2,function (er, ___a) { if (er) throw er
- ___callback___(null,___a)}) : return foo(1,2,3,4,function (er, ___a) { if (er) throw er
- ___callback___(null,___a)});
- }
- foo(1,2,3,function (er, bar) { if (er) throw er // var bar = foo(1,2,3)
- print(bar,function (er) { if (er) throw er // print(bar);
- bar += 3;
- b(4,5,function (er, c) { if (er) throw er // var c = b(4,5)
- print(c,function (er) { if (er) throw er // print(c)
- x(false,function (er, ___a) { if (er) throw er
- b(1,___a, function (er, ___a) { if (er) throw er
- print(___a, function (er) { if (er) throw er
- })})})})})})})
Add Comment
Please, Sign In to add comment