diff --git a/.DS_Store b/.DS_Store index dac9574..6238c55 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/build-all.sh b/build-all.sh index 54d1146..9f25c8c 100755 --- a/build-all.sh +++ b/build-all.sh @@ -22,5 +22,5 @@ cp ./lib/standard/postal.* ./example/standard/js cp ./lib/amd/postal.* ./example/amd/js/libs/postal cp ./lib/amd/postal.js ./example/node/client/js/lib cp ./lib/amd/postal.diagnostics.js ./example/node/client/js/lib -cp ./lib/node/postal.diagnostics.js ./example/node/messaging +cp ./lib/node/diags/postal.diagnostics.js ./example/node/messaging cp ./lib/node/postal.js ./example/node/messaging \ No newline at end of file diff --git a/example/amd/js/libs/postal/postal.diagnostics.js b/example/amd/js/libs/postal/postal.diagnostics.js index 754a85b..168df84 100644 --- a/example/amd/js/libs/postal/postal.diagnostics.js +++ b/example/amd/js/libs/postal/postal.diagnostics.js @@ -8,7 +8,10 @@ define( [ "postal", "underscore" ], function ( postal, _, undefined ) { _.each( filter, function ( item, key ) { if ( env[key] ) { possible++; - if ( _.isObject( env[key] ) && !_.isArray( env[key] ) ) { + if ( _.isRegExp( item ) && item.test( env[key] ) ) { + match++; + } + else if ( _.isObject( env[key] ) && !_.isArray( env[key] ) ) { if ( applyFilter( item, env[key] ) ) { match++; } diff --git a/example/amd/js/libs/postal/postal.diagnostics.min.js b/example/amd/js/libs/postal/postal.diagnostics.min.js index e301ec9..46a5dc2 100644 --- a/example/amd/js/libs/postal/postal.diagnostics.min.js +++ b/example/amd/js/libs/postal/postal.diagnostics.min.js @@ -1 +1 @@ -define(["postal","underscore"],function(a,b,c){var d=[],e=function(a,c){var d=0,f=0;return b.each(a,function(a,g){c[g]&&(f++,b.isObject(c[g])&&!b.isArray(c[g])?e(a,c[g])&&d++:b.isEqual(c[g],a)&&d++)}),d===f},f=a.addWireTap(function(a,c){if(!d.length||b.any(d,function(a){return e(a,c)})){if(!JSON)throw"This browser or environment does not provide JSON support";try{console.log(JSON.stringify(c))}catch(f){try{var g=b.extend({},c);delete g.data,console.log(JSON.stringify(g)+"\n "+"JSON.stringify Error: "+f.message)}catch(h){console.log("Unable to parse data to JSON: "+f)}}}});a.diagnostics=a.diagnostics||{},a.diagnostics.console={clearFilters:function(){d=[]},removeFilter:function(a){d=b.filter(d,function(c){return!b.isEqual(c,a)})},addFilter:function(a){b.isArray(a)||(a=[a]),b.each(a,function(a){(d.length===0||!b.any(d,function(c){return b.isEqual(c,a)}))&&d.push(a)})},getCurrentFilters:function(){return d},removeWireTap:function(){f&&f()}}}) \ No newline at end of file +define(["postal","underscore"],function(a,b,c){var d=[],e=function(a,c){var d=0,f=0;return b.each(a,function(a,g){c[g]&&(f++,b.isRegExp(a)&&a.test(c[g])?d++:b.isObject(c[g])&&!b.isArray(c[g])?e(a,c[g])&&d++:b.isEqual(c[g],a)&&d++)}),d===f},f=a.addWireTap(function(a,c){if(!d.length||b.any(d,function(a){return e(a,c)})){if(!JSON)throw"This browser or environment does not provide JSON support";try{console.log(JSON.stringify(c))}catch(f){try{var g=b.extend({},c);delete g.data,console.log(JSON.stringify(g)+"\n "+"JSON.stringify Error: "+f.message)}catch(h){console.log("Unable to parse data to JSON: "+f)}}}});a.diagnostics=a.diagnostics||{},a.diagnostics.console={clearFilters:function(){d=[]},removeFilter:function(a){d=b.filter(d,function(c){return!b.isEqual(c,a)})},addFilter:function(a){b.isArray(a)||(a=[a]),b.each(a,function(a){(d.length===0||!b.any(d,function(c){return b.isEqual(c,a)}))&&d.push(a)})},getCurrentFilters:function(){return d},removeWireTap:function(){f&&f()}}}) \ No newline at end of file diff --git a/example/node/client/js/lib/postal.diagnostics.js b/example/node/client/js/lib/postal.diagnostics.js index 754a85b..168df84 100644 --- a/example/node/client/js/lib/postal.diagnostics.js +++ b/example/node/client/js/lib/postal.diagnostics.js @@ -8,7 +8,10 @@ define( [ "postal", "underscore" ], function ( postal, _, undefined ) { _.each( filter, function ( item, key ) { if ( env[key] ) { possible++; - if ( _.isObject( env[key] ) && !_.isArray( env[key] ) ) { + if ( _.isRegExp( item ) && item.test( env[key] ) ) { + match++; + } + else if ( _.isObject( env[key] ) && !_.isArray( env[key] ) ) { if ( applyFilter( item, env[key] ) ) { match++; } diff --git a/example/node/messaging/postal.diagnostics.js b/example/node/messaging/postal.diagnostics.js index 0f6ccd6..b9f1222 100644 --- a/example/node/messaging/postal.diagnostics.js +++ b/example/node/messaging/postal.diagnostics.js @@ -5,7 +5,10 @@ module.exports = function ( _, postal ) { _.each( filter, function ( item, key ) { if ( env[key] ) { possible++; - if ( _.isObject( env[key] ) && !_.isArray( env[key] ) ) { + if ( _.isRegExp( item ) && item.test( env[key] ) ) { + match++; + } + else if ( _.isObject( env[key] ) && !_.isArray( env[key] ) ) { if ( applyFilter( item, env[key] ) ) { match++; } diff --git a/example/standard/js/postal.diagnostics.js b/example/standard/js/postal.diagnostics.js index a5cd3e6..eeeb2ca 100644 --- a/example/standard/js/postal.diagnostics.js +++ b/example/standard/js/postal.diagnostics.js @@ -8,7 +8,10 @@ _.each( filter, function ( item, key ) { if ( env[key] ) { possible++; - if ( _.isObject( env[key] ) && !_.isArray( env[key] ) ) { + if ( _.isRegExp( item ) && item.test( env[key] ) ) { + match++; + } + else if ( _.isObject( env[key] ) && !_.isArray( env[key] ) ) { if ( applyFilter( item, env[key] ) ) { match++; } diff --git a/example/standard/js/postal.diagnostics.min.js b/example/standard/js/postal.diagnostics.min.js index 6cfacda..8e73e2f 100644 --- a/example/standard/js/postal.diagnostics.min.js +++ b/example/standard/js/postal.diagnostics.min.js @@ -1 +1 @@ -(function(a,b,c){var d=[],e=function(a,c){var d=0,f=0;return b.each(a,function(a,g){c[g]&&(f++,b.isObject(c[g])&&!b.isArray(c[g])?e(a,c[g])&&d++:b.isEqual(c[g],a)&&d++)}),d===f},f=a.addWireTap(function(a,c){if(!d.length||b.any(d,function(a){return e(a,c)})){if(!JSON)throw"This browser or environment does not provide JSON support";try{console.log(JSON.stringify(c))}catch(f){try{var g=b.extend({},c);delete g.data,console.log(JSON.stringify(g)+"\n "+"JSON.stringify Error: "+f.message)}catch(h){console.log("Unable to parse data to JSON: "+f)}}}});a.diagnostics=a.diagnostics||{},a.diagnostics.console={clearFilters:function(){d=[]},removeFilter:function(a){d=b.filter(d,function(c){return!b.isEqual(c,a)})},addFilter:function(a){b.isArray(a)||(a=[a]),b.each(a,function(a){(d.length===0||!b.any(d,function(c){return b.isEqual(c,a)}))&&d.push(a)})},getCurrentFilters:function(){return d},removeWireTap:function(){f&&f()}}})(postal,_) \ No newline at end of file +(function(a,b,c){var d=[],e=function(a,c){var d=0,f=0;return b.each(a,function(a,g){c[g]&&(f++,b.isRegExp(a)&&a.test(c[g])?d++:b.isObject(c[g])&&!b.isArray(c[g])?e(a,c[g])&&d++:b.isEqual(c[g],a)&&d++)}),d===f},f=a.addWireTap(function(a,c){if(!d.length||b.any(d,function(a){return e(a,c)})){if(!JSON)throw"This browser or environment does not provide JSON support";try{console.log(JSON.stringify(c))}catch(f){try{var g=b.extend({},c);delete g.data,console.log(JSON.stringify(g)+"\n "+"JSON.stringify Error: "+f.message)}catch(h){console.log("Unable to parse data to JSON: "+f)}}}});a.diagnostics=a.diagnostics||{},a.diagnostics.console={clearFilters:function(){d=[]},removeFilter:function(a){d=b.filter(d,function(c){return!b.isEqual(c,a)})},addFilter:function(a){b.isArray(a)||(a=[a]),b.each(a,function(a){(d.length===0||!b.any(d,function(c){return b.isEqual(c,a)}))&&d.push(a)})},getCurrentFilters:function(){return d},removeWireTap:function(){f&&f()}}})(postal,_) \ No newline at end of file diff --git a/lib/amd/postal.diagnostics.js b/lib/amd/postal.diagnostics.js index 754a85b..168df84 100644 --- a/lib/amd/postal.diagnostics.js +++ b/lib/amd/postal.diagnostics.js @@ -8,7 +8,10 @@ define( [ "postal", "underscore" ], function ( postal, _, undefined ) { _.each( filter, function ( item, key ) { if ( env[key] ) { possible++; - if ( _.isObject( env[key] ) && !_.isArray( env[key] ) ) { + if ( _.isRegExp( item ) && item.test( env[key] ) ) { + match++; + } + else if ( _.isObject( env[key] ) && !_.isArray( env[key] ) ) { if ( applyFilter( item, env[key] ) ) { match++; } diff --git a/lib/amd/postal.diagnostics.min.js b/lib/amd/postal.diagnostics.min.js index e301ec9..46a5dc2 100644 --- a/lib/amd/postal.diagnostics.min.js +++ b/lib/amd/postal.diagnostics.min.js @@ -1 +1 @@ -define(["postal","underscore"],function(a,b,c){var d=[],e=function(a,c){var d=0,f=0;return b.each(a,function(a,g){c[g]&&(f++,b.isObject(c[g])&&!b.isArray(c[g])?e(a,c[g])&&d++:b.isEqual(c[g],a)&&d++)}),d===f},f=a.addWireTap(function(a,c){if(!d.length||b.any(d,function(a){return e(a,c)})){if(!JSON)throw"This browser or environment does not provide JSON support";try{console.log(JSON.stringify(c))}catch(f){try{var g=b.extend({},c);delete g.data,console.log(JSON.stringify(g)+"\n "+"JSON.stringify Error: "+f.message)}catch(h){console.log("Unable to parse data to JSON: "+f)}}}});a.diagnostics=a.diagnostics||{},a.diagnostics.console={clearFilters:function(){d=[]},removeFilter:function(a){d=b.filter(d,function(c){return!b.isEqual(c,a)})},addFilter:function(a){b.isArray(a)||(a=[a]),b.each(a,function(a){(d.length===0||!b.any(d,function(c){return b.isEqual(c,a)}))&&d.push(a)})},getCurrentFilters:function(){return d},removeWireTap:function(){f&&f()}}}) \ No newline at end of file +define(["postal","underscore"],function(a,b,c){var d=[],e=function(a,c){var d=0,f=0;return b.each(a,function(a,g){c[g]&&(f++,b.isRegExp(a)&&a.test(c[g])?d++:b.isObject(c[g])&&!b.isArray(c[g])?e(a,c[g])&&d++:b.isEqual(c[g],a)&&d++)}),d===f},f=a.addWireTap(function(a,c){if(!d.length||b.any(d,function(a){return e(a,c)})){if(!JSON)throw"This browser or environment does not provide JSON support";try{console.log(JSON.stringify(c))}catch(f){try{var g=b.extend({},c);delete g.data,console.log(JSON.stringify(g)+"\n "+"JSON.stringify Error: "+f.message)}catch(h){console.log("Unable to parse data to JSON: "+f)}}}});a.diagnostics=a.diagnostics||{},a.diagnostics.console={clearFilters:function(){d=[]},removeFilter:function(a){d=b.filter(d,function(c){return!b.isEqual(c,a)})},addFilter:function(a){b.isArray(a)||(a=[a]),b.each(a,function(a){(d.length===0||!b.any(d,function(c){return b.isEqual(c,a)}))&&d.push(a)})},getCurrentFilters:function(){return d},removeWireTap:function(){f&&f()}}}) \ No newline at end of file diff --git a/lib/node/diags/package.json b/lib/node/diags/package.json index ca86bab..e247177 100644 --- a/lib/node/diags/package.json +++ b/lib/node/diags/package.json @@ -1,7 +1,7 @@ { "name" : "postal.diagnostics", "description" : "Wiretap add-on for postal.js allowing configurable console.logging output of messages being published through postal's message bus.", - "version" : "0.6.0", + "version" : "0.6.1", "homepage" : "http://github.com/ifandelse/postal.js", "repository" : { "type" : "git", diff --git a/lib/node/diags/postal.diagnostics.js b/lib/node/diags/postal.diagnostics.js index 0f6ccd6..b9f1222 100644 --- a/lib/node/diags/postal.diagnostics.js +++ b/lib/node/diags/postal.diagnostics.js @@ -5,7 +5,10 @@ module.exports = function ( _, postal ) { _.each( filter, function ( item, key ) { if ( env[key] ) { possible++; - if ( _.isObject( env[key] ) && !_.isArray( env[key] ) ) { + if ( _.isRegExp( item ) && item.test( env[key] ) ) { + match++; + } + else if ( _.isObject( env[key] ) && !_.isArray( env[key] ) ) { if ( applyFilter( item, env[key] ) ) { match++; } diff --git a/lib/standard/postal.diagnostics.js b/lib/standard/postal.diagnostics.js index a5cd3e6..eeeb2ca 100644 --- a/lib/standard/postal.diagnostics.js +++ b/lib/standard/postal.diagnostics.js @@ -8,7 +8,10 @@ _.each( filter, function ( item, key ) { if ( env[key] ) { possible++; - if ( _.isObject( env[key] ) && !_.isArray( env[key] ) ) { + if ( _.isRegExp( item ) && item.test( env[key] ) ) { + match++; + } + else if ( _.isObject( env[key] ) && !_.isArray( env[key] ) ) { if ( applyFilter( item, env[key] ) ) { match++; } diff --git a/lib/standard/postal.diagnostics.min.js b/lib/standard/postal.diagnostics.min.js index 6cfacda..8e73e2f 100644 --- a/lib/standard/postal.diagnostics.min.js +++ b/lib/standard/postal.diagnostics.min.js @@ -1 +1 @@ -(function(a,b,c){var d=[],e=function(a,c){var d=0,f=0;return b.each(a,function(a,g){c[g]&&(f++,b.isObject(c[g])&&!b.isArray(c[g])?e(a,c[g])&&d++:b.isEqual(c[g],a)&&d++)}),d===f},f=a.addWireTap(function(a,c){if(!d.length||b.any(d,function(a){return e(a,c)})){if(!JSON)throw"This browser or environment does not provide JSON support";try{console.log(JSON.stringify(c))}catch(f){try{var g=b.extend({},c);delete g.data,console.log(JSON.stringify(g)+"\n "+"JSON.stringify Error: "+f.message)}catch(h){console.log("Unable to parse data to JSON: "+f)}}}});a.diagnostics=a.diagnostics||{},a.diagnostics.console={clearFilters:function(){d=[]},removeFilter:function(a){d=b.filter(d,function(c){return!b.isEqual(c,a)})},addFilter:function(a){b.isArray(a)||(a=[a]),b.each(a,function(a){(d.length===0||!b.any(d,function(c){return b.isEqual(c,a)}))&&d.push(a)})},getCurrentFilters:function(){return d},removeWireTap:function(){f&&f()}}})(postal,_) \ No newline at end of file +(function(a,b,c){var d=[],e=function(a,c){var d=0,f=0;return b.each(a,function(a,g){c[g]&&(f++,b.isRegExp(a)&&a.test(c[g])?d++:b.isObject(c[g])&&!b.isArray(c[g])?e(a,c[g])&&d++:b.isEqual(c[g],a)&&d++)}),d===f},f=a.addWireTap(function(a,c){if(!d.length||b.any(d,function(a){return e(a,c)})){if(!JSON)throw"This browser or environment does not provide JSON support";try{console.log(JSON.stringify(c))}catch(f){try{var g=b.extend({},c);delete g.data,console.log(JSON.stringify(g)+"\n "+"JSON.stringify Error: "+f.message)}catch(h){console.log("Unable to parse data to JSON: "+f)}}}});a.diagnostics=a.diagnostics||{},a.diagnostics.console={clearFilters:function(){d=[]},removeFilter:function(a){d=b.filter(d,function(c){return!b.isEqual(c,a)})},addFilter:function(a){b.isArray(a)||(a=[a]),b.each(a,function(a){(d.length===0||!b.any(d,function(c){return b.isEqual(c,a)}))&&d.push(a)})},getCurrentFilters:function(){return d},removeWireTap:function(){f&&f()}}})(postal,_) \ No newline at end of file diff --git a/src/diags/postal.diagnostics.js b/src/diags/postal.diagnostics.js index 419edd5..34241c9 100644 --- a/src/diags/postal.diagnostics.js +++ b/src/diags/postal.diagnostics.js @@ -4,7 +4,10 @@ var filters = [], _.each( filter, function ( item, key ) { if ( env[key] ) { possible++; - if ( _.isObject( env[key] ) && !_.isArray( env[key] ) ) { + if ( _.isRegExp( item ) && item.test( env[key] ) ) { + match++; + } + else if ( _.isObject( env[key] ) && !_.isArray( env[key] ) ) { if ( applyFilter( item, env[key] ) ) { match++; }