From 968506a8ddbd2b8310e7e3e13a4765e1b4c392a6 Mon Sep 17 00:00:00 2001 From: Alex Liebowitz Date: Thu, 1 Sep 2016 03:28:07 -0400 Subject: [PATCH] Add lbry.formatName() --- js/lbry.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/lbry.js b/js/lbry.js index 00cbbe626..381dde98f 100644 --- a/js/lbry.js +++ b/js/lbry.js @@ -258,6 +258,11 @@ lbry.formatCredits = function(amount, precision) 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) { var lbryScriptTag = document.getElementById('lbry'),