diff options
Diffstat (limited to 'lib/util.js')
-rw-r--r-- | lib/util.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/util.js b/lib/util.js index fb0b13f..7425513 100644 --- a/lib/util.js +++ b/lib/util.js @@ -5,12 +5,13 @@ var b64url = require('base64-url') var u = exports u.ssbRefRegex = /((?:@|%|&|ssb:\/\/%)[A-Za-z0-9\/+]{43}=\.[\w\d]+)/g +u.ssbRefRegexOnly = /^(?:@|%|&|ssb:\/\/%)[A-Za-z0-9\/+]{43}=\.[\w\d]+$/ u.ssbRefEncRegex = /((?:ssb:\/\/)?(?:[@%&]|%26|%40|%25)(?:[A-Za-z0-9\/+]|%2[fF]|%2[bB]){43}(?:=|%3[dD])\.[\w\d]+)/g u.isRef = function (str) { if (!str) return false - u.ssbRefRegex.lastIndex = 0 - return u.ssbRefRegex.test(str) + u.ssbRefRegexOnly.lastIndex = 0 + return u.ssbRefRegexOnly.test(str) } u.readNext = function (fn) { |