From 5b380feed6c2e095b62158b20c4fca5f272450b0 Mon Sep 17 00:00:00 2001 From: Jack Allnutt Date: Thu, 26 Sep 2013 20:12:56 +0100 Subject: [PATCH] Refactor _kiwi.model.Member#stripPrefix --- client/assets/src/models/member.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/client/assets/src/models/member.js b/client/assets/src/models/member.js index 70bf75e..f1bc61b 100644 --- a/client/assets/src/models/member.js +++ b/client/assets/src/models/member.js @@ -76,22 +76,20 @@ _kiwi.model.Member = Backbone.Model.extend({ return prefix; }, stripPrefix: function (nick) { - var tmp = nick, i, j, k, cont = false; + var tmp = nick, i, j, k, j_char; var user_prefixes = _kiwi.gateway.get('user_prefixes'); i = 0; + j_loop: for (j = 0; j < nick.length; j++) { + j_char = nick.charAt(j); for (k = 0; k < user_prefixes.length; k++) { - if (nick.charAt(j) === user_prefixes[k].symbol) { + if (j_char === user_prefixes[k].symbol) { i++; - cont = true; - break; + continue j_loop; } } - if (!cont) { - break; - } - cont = false; + break; } return tmp.substr(i); -- 2.25.1