mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-11-22 16:30:11 +00:00
0f65e4c9f3
Reintroduce HackMyCore, dropping the interim submodule, and reorganize and improve tests.
28 lines
553 B
JavaScript
28 lines
553 B
JavaScript
|
|
/**
|
|
Definitions of string utility functions.
|
|
@module utils/string
|
|
*/
|
|
|
|
|
|
/**
|
|
Determine if the string is null, empty, or whitespace.
|
|
See: http://stackoverflow.com/a/32800728/4942583
|
|
@method isNullOrWhitespace
|
|
*/
|
|
|
|
(function() {
|
|
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;
|
|
};
|
|
|
|
}).call(this);
|