mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2025-05-12 00:27:08 +01:00
24 lines
562 B
JavaScript
24 lines
562 B
JavaScript
/**
|
|
Definitions of string utility functions.
|
|
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
|
|
@module string.js
|
|
*/
|
|
|
|
/**
|
|
Determine if the string is null, empty, or whitespace.
|
|
See: http://stackoverflow.com/a/32800728/4942583
|
|
@method isNullOrWhitespace
|
|
*/
|
|
|
|
String.isNullOrWhitespace = function( input ) {
|
|
return !input || !input.trim();
|
|
};
|
|
|
|
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;
|
|
};
|