Add lbry.formatName()

This commit is contained in:
Alex Liebowitz 2016-09-01 03:28:07 -04:00
parent aa7abb2451
commit 968506a8dd

View file

@ -258,6 +258,11 @@ lbry.formatCredits = function(amount, precision)
return amount.toFixed(precision || 1).replace(/\.?0+$/, ''); return amount.toFixed(precision || 1).replace(/\.?0+$/, '');
} }
lbry.formatName = function(name) {
// Converts LBRY name to standard format (all lower case, no special characters)
return name.toLowerCase().replace(/[^a-z0-9\-]/, '');
}
lbry.loadJs = function(src, type, onload) lbry.loadJs = function(src, type, onload)
{ {
var lbryScriptTag = document.getElementById('lbry'), var lbryScriptTag = document.getElementById('lbry'),