From cdbb2640933f62e5df4ed1f7a82b03b7e9bee495 Mon Sep 17 00:00:00 2001 From: hacksalot Date: Sun, 20 Dec 2015 18:42:02 -0500 Subject: [PATCH] Add string convenience method. --- src/utils/string.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/utils/string.js b/src/utils/string.js index 8cee01f..9da084f 100644 --- a/src/utils/string.js +++ b/src/utils/string.js @@ -17,3 +17,7 @@ String.isNullOrWhitespace = function( input ) { String.prototype.endsWith = function(suffix) { return this.indexOf(suffix, this.length - suffix.length) !== -1; }; + +String.is = function( val ) { + return typeof val === 'string' || val instanceof String; +};