From 4f14553eb693e5130c4a87a0d521b934e2fbbc31 Mon Sep 17 00:00:00 2001 From: ewinslow Date: Tue, 2 Nov 2010 14:47:12 +0000 Subject: Refs #2538: Added type checking to some more core functions git-svn-id: http://code.elgg.org/elgg/trunk@7187 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/js/lib/elgglib.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'engine/js/lib/elgglib.js') diff --git a/engine/js/lib/elgglib.js b/engine/js/lib/elgglib.js index f7c30bdc2..a91def2b9 100644 --- a/engine/js/lib/elgglib.js +++ b/engine/js/lib/elgglib.js @@ -1,7 +1,6 @@ /** - * @author Evan Winslow * - * $Id: elgglib.js 76 2010-07-17 02:08:02Z evan.b.winslow $ + * */ /** @@ -11,7 +10,7 @@ var elgg = elgg || {}; elgg.assertTypeOf = function(type, param) { if (typeof param !== type) { - throw new TypeError("Expecting param to be a " + type + ". Was a " + typeof param + "."); + throw new TypeError("Expecting param to be a(n) " + type + ". Was a(n) " + typeof param + "."); } }; @@ -27,6 +26,8 @@ elgg.global = this; * @param {String} pkg The required package (e.g., 'elgg.package') */ elgg.require = function(pkg) { + elgg.assertTypeOf('string', pkg); + var parts = pkg.split('.'), cur = elgg.global, part; @@ -56,6 +57,8 @@ elgg.require = function(pkg) { * */ elgg.provide = function(pkg) { + elgg.assertTypeOf('string', pkg); + var parts = pkg.split('.'), cur = elgg.global, part; @@ -140,7 +143,7 @@ elgg.system_messages = function(msgs, delay, type) { msgs = [msgs]; } - var messages_html = []; + var messages_html = [];f for (var i in msgs) { messages_html.push('

' + msgs[i] + '

'); -- cgit v1.2.3