summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shell/mongo_vstudio.cpp10
-rw-r--r--shell/utils.js2
2 files changed, 10 insertions, 2 deletions
diff --git a/shell/mongo_vstudio.cpp b/shell/mongo_vstudio.cpp
index 4ef1eaaddaa..b4fb64b93e2 100644
--- a/shell/mongo_vstudio.cpp
+++ b/shell/mongo_vstudio.cpp
@@ -321,6 +321,14 @@ const StringData _jscode_raw_utils =
"return this.replace(/\\s+$/,\"\");\n"
"}\n"
"\n"
+"String.prototype.startsWith = function (str){\n"
+"return this.indexOf(str) == 0\n"
+"}\n"
+"\n"
+"String.prototype.endsWith = function (str){\n"
+"return new RegExp( str + \"$\" ).test( this )\n"
+"}\n"
+"\n"
"Number.prototype.zeroPad = function(width) {\n"
"var str = this + '';\n"
"while (str.length < width)\n"
@@ -506,7 +514,7 @@ const StringData _jscode_raw_utils =
"\n"
"if( typeof Array.isArray != \"function\" ){\n"
"Array.isArray = function( arr ){\n"
-"return arr.constructor == Array\n"
+"return arr != undefined && arr.constructor == Array\n"
"}\n"
"}\n"
"\n"
diff --git a/shell/utils.js b/shell/utils.js
index 841793b45ba..a3c1d580bf5 100644
--- a/shell/utils.js
+++ b/shell/utils.js
@@ -509,7 +509,7 @@ Array.stdDev = function( arr ){
if( typeof Array.isArray != "function" ){
Array.isArray = function( arr ){
- return arr.constructor == Array
+ return arr != undefined && arr.constructor == Array
}
}