@compute.ts/string
Version:
Provide string operators for the computeTS package
1 lines • 5.35 kB
JavaScript
;function charAt(r,e){if(void 0===r)throw Error("The str value is undefined");if(null===r)throw Error("The str value is null");if(void 0===e)throw Error("The index value is undefined");if(null===e)throw Error("The index value is null");if(isNaN(e))throw Error("The index value is not a numeric");if(e<0||e>=r.length)throw Error("The index is out of bounds");return r.charAt(e)}function concat(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];for(var i="",o=0;o<r.length;o++){var t=r[o];if(void 0===t)throw Error("The "+o+"eme value is undefined");if(null===t)throw Error("The "+o+"eme value is null");i+=t}return i}function endsWith(r,e){if(void 0===r)throw Error("The str value is undefined");if(null===r)throw Error("The str value is null");if(void 0===e)throw Error("The token value is undefined");if(null===e)throw Error("The token value is null");return r.endsWith(e)}function include(r,e){if(void 0===r)throw Error("The str value is undefined");if(null===r)throw Error("The str value is null");if(void 0===e)throw Error("The token value is undefined");if(null===e)throw Error("The token value is null");return r.includes(e)}function indexOf(r,e){if(void 0===r)throw Error("The str value is undefined");if(null===r)throw Error("The str value is null");if(void 0===e)throw Error("The token value is undefined");if(null===e)throw Error("The token value is null");return r.indexOf(e)}function is(r,e){if(void 0===r)throw Error("The left value is undefined");if(null===r)throw Error("The left value is null");if(void 0===e)throw Error("The right value is undefined");if(null===e)throw Error("The right value is null");return r===e}function isClear(r){if(void 0===r)throw Error("The value is undefined");if(null===r)throw Error("The value is null");return 0==r.length}function isNot(r,e){if(void 0===r)throw Error("The left value is undefined");if(null===r)throw Error("The left value is null");if(void 0===e)throw Error("The right value is undefined");if(null===e)throw Error("The right value is null");return r!==e}function length(r){if(void 0===r)throw Error("The value is undefined");if(null===r)throw Error("The value is null");return r.length}function padEnd(r,e,i){if(void 0===r)throw Error("The value is undefined");if(null===r)throw Error("The value is null");if(void 0===e)throw Error("The fillingChar value is undefined");if(null===e)throw Error("The fillingChar value is null");if(void 0===i)throw Error("The maxLength value is undefined");if(null===i)throw Error("The maxLength value is null");if(isNaN(i))throw Error("The maxLength value is not a numeric");return r.padEnd(i,e)}function padStart(r,e,i){if(void 0===r)throw Error("The value is undefined");if(null===r)throw Error("The value is null");if(void 0===e)throw Error("The fillingChar value is undefined");if(null===e)throw Error("The fillingChar value is null");if(void 0===i)throw Error("The maxLength value is undefined");if(null===i)throw Error("The maxLength value is null");if(isNaN(i))throw Error("The maxLength value is not a numeric");return r.padStart(i,e)}function replace(r,e,i){if(void 0===r)throw Error("The value is undefined");if(null===r)throw Error("The value is null");return r.replace(e,i)}function slice(r,e,i){if(e<0)throw Error("The index is out of bounds");if(e>=r.length)throw Error("The index is out of bounds");if(i<0)throw Error("The index is out of bounds");if(i>=r.length)throw Error("The index is out of bounds");if(i<e)throw Error("The index is out of bounds");return r.slice(e,i)}function startsWith(r,e){if(void 0===r)throw Error("The str value is undefined");if(null===r)throw Error("The str value is null");if(void 0===e)throw Error("The token value is undefined");if(null===e)throw Error("The token value is null");return r.startsWith(e)}function subString(r,e,i){if((e<0||e>=r.length)&&Error("The from value is out of bounds"),i<0)throw Error("The length value is out of bounds");if(void 0===e)throw Error("The from value is undefined");if(null===e)throw Error("The from value is null");if(void 0===i)throw Error("The length value is undefined");if(null===i)throw Error("The length value is null");return r.substr(e,i)}function toLowercase(r){if(void 0===r)throw Error("The value is undefined");if(null===r)throw Error("The value is null");return r.toLowerCase()}function toUppercase(r){if(void 0===r)throw Error("The value is undefined");if(null===r)throw Error("The value is null");return r.toUpperCase()}function trim(r){if(void 0===r)throw Error("The value is undefined");if(null===r)throw Error("The value is null");return r.trim()}Object.defineProperty(exports,"__esModule",{value:!0}),exports.trim=exports.toUppercase=exports.toLowercase=exports.subString=exports.startsWith=exports.slice=exports.replace=exports.padStart=exports.padEnd=exports.length=exports.isNot=exports.isClear=exports.is=exports.indexOf=exports.include=exports.endsWith=exports.concat=exports.charAt=void 0,exports.charAt=charAt,exports.concat=concat,exports.endsWith=endsWith,exports.include=include,exports.indexOf=indexOf,exports.is=is,exports.isClear=isClear,exports.isNot=isNot,exports.length=length,exports.padEnd=padEnd,exports.padStart=padStart,exports.replace=replace,exports.slice=slice,exports.startsWith=startsWith,exports.subString=subString,exports.toLowercase=toLowercase,exports.toUppercase=toUppercase,exports.trim=trim;