aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-02 14:47:12 +0000
committerewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-02 14:47:12 +0000
commit4f14553eb693e5130c4a87a0d521b934e2fbbc31 (patch)
tree795d03ffdc4ea7f221b1d77965d0b69aeb9ea7d3 /engine
parentf7ae28ea45656d2821262998e9a71c351dcced8c (diff)
downloadelgg-4f14553eb693e5130c4a87a0d521b934e2fbbc31.tar.gz
elgg-4f14553eb693e5130c4a87a0d521b934e2fbbc31.tar.bz2
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
Diffstat (limited to 'engine')
-rw-r--r--engine/js/lib/elgglib.js11
1 files changed, 7 insertions, 4 deletions
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) {
* </pre>
*/
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('<div class="' + classes.join(' ') + '"><p>' + msgs[i] + '</p></div>');