commit 0a88032715d1745b9f9d7e396cf22fe1d9337b94 parent 995bc9667b99563d06985e199e29aafff3942ae8 Author: Aurimas Vinckevicius <aurimas.dev@gmail.com> Date: Sun, 20 Sep 2015 17:10:38 -0500 ZU.capitalize should not throw for empty string Diffstat:
| M | chrome/content/zotero/xpcom/utilities.js | | | 2 | ++ |
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js @@ -914,6 +914,8 @@ Zotero.Utilities = { }, "capitalize": function (str) { + if (typeof str != 'string') throw new Error("Argument must be a string"); + if (!str) return str; // Empty string return str[0].toUpperCase() + str.substr(1); },