From f46cc65aba48442ca4b2067faaa3281490a72f79 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Tue, 12 Aug 2014 11:03:01 -0400 Subject: [PATCH 1/3] bip21: use RegExp.exec instead of String.match. --- lib/BIP21.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/BIP21.js b/lib/BIP21.js index 3ac023b..9253f1a 100644 --- a/lib/BIP21.js +++ b/lib/BIP21.js @@ -56,7 +56,7 @@ BIP21.prototype.parse = function(uri) { } // workaround to host insensitiveness - var group = uri.match('[^:]*:/?/?([^?]*)'); + var group = /[^:]*:/?/?([^?]*)/.exec(uri); this.setAddress(group && group[1]); for (var arg in info.query) { From 11ecfd16677e6a709d2fbaedac89aee5093de882 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Tue, 12 Aug 2014 11:03:24 -0400 Subject: [PATCH 2/3] bip21: use triple equal for consistency. --- lib/BIP21.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/BIP21.js b/lib/BIP21.js index 9253f1a..f8930a6 100644 --- a/lib/BIP21.js +++ b/lib/BIP21.js @@ -61,7 +61,7 @@ BIP21.prototype.parse = function(uri) { for (var arg in info.query) { var val = info.query[arg]; - if (arg == 'amount') val = Number(val); + if (arg === 'amount') val = Number(val); this.data[arg] = val; } } From 363e27d49366f34bb8c9558c91e4db75b13e0a41 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Tue, 12 Aug 2014 11:03:43 -0400 Subject: [PATCH 3/3] bip21: check for arg `r=` and set merchant. --- lib/BIP21.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/BIP21.js b/lib/BIP21.js index f8930a6..acdb445 100644 --- a/lib/BIP21.js +++ b/lib/BIP21.js @@ -62,6 +62,7 @@ BIP21.prototype.parse = function(uri) { for (var arg in info.query) { var val = info.query[arg]; if (arg === 'amount') val = Number(val); + if (arg === 'r') this.data.merchant = val; this.data[arg] = val; } }