@slck/utils
Version:
utils library - Utility functions for common development.
26 lines • 939 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("../utils");
String.prototype.isPalindrome = function () {
const str = this.replace(/[^A-Za-z0-9]/g, '').toLowerCase();
const reversed = str.split('').reverse().join('');
return str === reversed;
};
String.prototype.addSpacesToCamelCase = function () {
return this.replace(/([A-Z])/g, ' $1').trim();
};
String.prototype.convertFirstLetterToUpper = function (seperator = ' ') {
return this
? this
.split(`${seperator}`)
.map((s) => (s ? s[0].toUpperCase() : ''))
.join('')
: ``;
};
String.prototype.isNullOrUndefined = function () {
return this === null || this === undefined;
};
String.prototype.isNullOrUndefinedEmpty = function () {
return (0, utils_1.isNullOrUndefined)(this) || (0, utils_1.isEmpty)(this);
};
//# sourceMappingURL=string-extensions.js.map
;