shufflejs-react
Version:
React component for ShuffleJs
18 lines • 1.28 kB
JavaScript
;Object.defineProperty(exports,"__esModule",{value:!0}),exports.stripTags=exports.putSearchParams=exports.jsUcfirst=void 0;// Utils
/**
* Capitalie first letter of string and return new string
* Taken from https://paulund.co.uk/how-to-capitalize-the-first-letter-of-a-string-in-javascript
* And referenced from http://php.net/manual/en/function.ucfirst.php
* @param {String} string to be capitalize first letter e.g. test
* @return {String} test > Text
*/var jsUcfirst=function(a){return a.charAt(0).toUpperCase()+a.slice(1)};/**
* Put search parameter to the url
* If the search parameter is '', then only pathname
* If it's not empty-string, then add it to the url with '/?'
* @param {String} searchParams to put on the url as '.../?searchParams'
*/exports.jsUcfirst=jsUcfirst;var putSearchParams=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:"",b=window.location.pathname+(a?"?".concat(a.toLowerCase()):"");window.history.pushState(null,"",b)};/**
* Remove tag from string
* e.g. "<p>test</p>"
* @param {(String|HTML)} str html as string
* @return {HTML} str > test
*/exports.putSearchParams=putSearchParams;var stripTags=function(a){return a?(a.toString(),a.replace(/<\/?[^>]+>/gi,"")):null};exports.stripTags=stripTags;