From b803eba934f1481d94299f6cdf691f1d86f2c558 Mon Sep 17 00:00:00 2001 From: hacksalot Date: Tue, 29 Dec 2015 10:26:30 -0500 Subject: [PATCH] Scrub string.js. Will probably be retired in favor of Node reusables. --- src/utils/string.js | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/utils/string.js b/src/utils/string.js index 9da084f..c5b759f 100644 --- a/src/utils/string.js +++ b/src/utils/string.js @@ -1,6 +1,5 @@ /** Definitions of string utility functions. -@license MIT. Copyright (c) 2015 James Devlin / FluentDesk. @module string.js */ @@ -10,14 +9,18 @@ See: http://stackoverflow.com/a/32800728/4942583 @method isNullOrWhitespace */ -String.isNullOrWhitespace = function( input ) { - return !input || !input.trim(); -}; +(function() { -String.prototype.endsWith = function(suffix) { - return this.indexOf(suffix, this.length - suffix.length) !== -1; -}; + String.isNullOrWhitespace = function( input ) { + return !input || !input.trim(); + }; -String.is = function( val ) { - return typeof val === 'string' || val instanceof String; -}; + 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; + }; + +}());