Skip to content
Browse files

Use aok as unused result scope.

  • Loading branch information...
1 parent bf505b0 commit 8aa006b705254231a92a79c29a2ed2fe5377dc36 @ryanve committed
Showing with 11 additions and 19 deletions.
  1. +5 −9 aok.js
  2. +2 −2 aok.min.js
  3. +4 −8 src/aok.js
View
14 aok.js
@@ -1,5 +1,5 @@
/*!
- * aok 1.4.0+201310162201
+ * aok 1.4.0+201310162228
* https://github.com/ryanve/aok
* MIT License 2013 Ryan Van Etten
*/
@@ -91,17 +91,13 @@
* @example result(0) // 0
* @example result([1], 0) // 1
*/
- aok['result'] = function(o, k) {
+ function result(o, k) {
2 == arguments.length ? k = o[k] : (k = o, o = this);
return typeof k == 'function' ? k.call(o) : k;
- };
-
- /**
- * @this {Object}
- * @param {string|number} k
- */
+ }
+ aok['result'] = result;
aok.prototype['result'] = function(k) {
- return aok['result'].apply(null, 2 == arguments.length ? arguments : [this, k]);
+ return result.apply(aok, 2 == arguments.length ? arguments : [this, k]);
};
/**
View
4 aok.min.js
@@ -1,6 +1,6 @@
/*!
- * aok 1.4.0+201310162201
+ * aok 1.4.0+201310162228
* https://github.com/ryanve/aok
* MIT License 2013 Ryan Van Etten
*/
-!function(a,b,c){"undefined"!=typeof module&&module.exports?module.exports=c():a[b]=c()}(this,"aok",function(){function a(a){if(a&&"object"==typeof a)for(var b in a)e.call(a,b)&&(this[b]=a[b]);else arguments.length&&(this.test=a);this.init()}function b(b){return arguments.length?new a(b):new a}var c=function(){return this}(),d={},e=d.hasOwnProperty,f=d.toString,g="undefined"!=typeof window&&window,h="undefined"!=typeof document&&document,i="undefined"!=typeof console&&console,j=g&&"alert"in g,k=0;return b.prototype=a.prototype,b.prototype.pass="Pass",b.prototype.fail="Fail",function(a,b,c,d){function e(e,f,g){var h=b&&"function"==typeof b[e]?function(){b[e].apply(b,arguments)}:c?function(){h.force&&d.alert(e+": "+[].join.call(arguments," "))}:function(){};h.force=!!f,a[g||e]=h}e("info",1),e("warn",1),e("error",1),e("trace"),e("log"),e("log",0,"express")}(b,i,j,g),b.prototype.express=b.express,b.prototype.explain=b.explain=function(a){return a=arguments.length?a:this,a===Object(a)?f.call(a):""+a},b.result=function(a,b){return 2==arguments.length?b=a[b]:(b=a,a=this),"function"==typeof b?b.call(a):b},b.prototype.result=function(a){return b.result.apply(null,2==arguments.length?arguments:[this,a])},b.can=function(a){return function(){try{("string"==typeof a?this[a]:a).apply(this,arguments)}catch(b){return!1}return!0}},b.prototype.init=function(){if(this===c)throw new Error("@this");return e.call(this,"id")||(this.id=++k),e.call(this,"test")&&this.run(),this},b.prototype.run=function(){if(this===c)throw new Error("@this");return this.test=!!this.result("test"),this.handler()},b.prototype.cull=function(a){return this[this[null==a?"test":a]?"pass":"fail"]},b.prototype.handler=function(){var a=this.cull();return"function"==typeof a?a.call(this):(a=this.explain(a),e.call(this,"remark")&&(a+=" ("+this.explain(this.remark)+")"),this.express("#"+this.id+": "+a)),this},b.id=function(a){return h.getElementById(a)||!1},b});
+!function(a,b,c){"undefined"!=typeof module&&module.exports?module.exports=c():a[b]=c()}(this,"aok",function(){function a(a){if(a&&"object"==typeof a)for(var b in a)f.call(a,b)&&(this[b]=a[b]);else arguments.length&&(this.test=a);this.init()}function b(b){return arguments.length?new a(b):new a}function c(a,b){return 2==arguments.length?b=a[b]:(b=a,a=this),"function"==typeof b?b.call(a):b}var d=function(){return this}(),e={},f=e.hasOwnProperty,g=e.toString,h="undefined"!=typeof window&&window,i="undefined"!=typeof document&&document,j="undefined"!=typeof console&&console,k=h&&"alert"in h,l=0;return b.prototype=a.prototype,b.prototype.pass="Pass",b.prototype.fail="Fail",function(a,b,c,d){function e(e,f,g){var h=b&&"function"==typeof b[e]?function(){b[e].apply(b,arguments)}:c?function(){h.force&&d.alert(e+": "+[].join.call(arguments," "))}:function(){};h.force=!!f,a[g||e]=h}e("info",1),e("warn",1),e("error",1),e("trace"),e("log"),e("log",0,"express")}(b,j,k,h),b.prototype.express=b.express,b.prototype.explain=b.explain=function(a){return a=arguments.length?a:this,a===Object(a)?g.call(a):""+a},b.result=c,b.prototype.result=function(a){return c.apply(b,2==arguments.length?arguments:[this,a])},b.can=function(a){return function(){try{("string"==typeof a?this[a]:a).apply(this,arguments)}catch(b){return!1}return!0}},b.prototype.init=function(){if(this===d)throw new Error("@this");return f.call(this,"id")||(this.id=++l),f.call(this,"test")&&this.run(),this},b.prototype.run=function(){if(this===d)throw new Error("@this");return this.test=!!this.result("test"),this.handler()},b.prototype.cull=function(a){return this[this[null==a?"test":a]?"pass":"fail"]},b.prototype.handler=function(){var a=this.cull();return"function"==typeof a?a.call(this):(a=this.explain(a),f.call(this,"remark")&&(a+=" ("+this.explain(this.remark)+")"),this.express("#"+this.id+": "+a)),this},b.id=function(a){return i.getElementById(a)||!1},b});
View
12 src/aok.js
@@ -85,17 +85,13 @@
* @example result(0) // 0
* @example result([1], 0) // 1
*/
- aok['result'] = function(o, k) {
+ function result(o, k) {
2 == arguments.length ? k = o[k] : (k = o, o = this);
return typeof k == 'function' ? k.call(o) : k;
- };
-
- /**
- * @this {Object}
- * @param {string|number} k
- */
+ }
+ aok['result'] = result;
aok.prototype['result'] = function(k) {
- return aok['result'].apply(null, 2 == arguments.length ? arguments : [this, k]);
+ return result.apply(aok, 2 == arguments.length ? arguments : [this, k]);
};
/**

0 comments on commit 8aa006b

Please sign in to comment.
Something went wrong with that request. Please try again.