funtool
Version:
A modern, efficient, and modular JavaScript utility library designed to enhance developer productivity.
3 lines (2 loc) • 2.67 kB
JavaScript
function n(n){return n?n.charAt(0).toUpperCase()+n.slice(1):""}function e(n,e){return(n.match(new RegExp(e,"g"))||[]).length}function t(n,e){return n.indexOf(e)}function r(n,e,t){const r="number"==typeof t?t:n.indexOf(t);return r<0||r>=n.length?n:n.slice(0,r+1)+e+n.slice(r+1)}function o(n,e,t){const r="number"==typeof t?t:n.indexOf(t);return r<0||r>n.length?n:n.slice(0,r)+e+n.slice(r)}function i(n){return n?n.charAt(0).toLowerCase()+n.slice(1):""}function u(n,e,t=" "){return n.padEnd(e,t)}function c(n,e,t=" "){return n.padStart(e,t)}function s(n,e){const t="number"==typeof e?e:n.indexOf(e);return t>=0?n.slice(0,t+1):n}function f(n,e){const t="number"==typeof e?e:n.indexOf(e);return t<0||t>=n.length?n:n.slice(0,t)+n.slice(t+1)}function a(n,e){const t="number"==typeof e?e:n.indexOf(e);return t>=0?n.slice(t):n}function p(n,e){return n.repeat(e)}function l(n,e,t){return n.split(e).join(t)}function g(n){return n.split("").reverse().join("")}function C(n,e,t){return n.substring(e,t)}function m(n){return n.replace(/[_\-\s]+/g," ").trim().split(/\s+/).flatMap((n=>n.match(/[A-Z]{2,}(?=[A-Z][a-z]|[0-9]|$)|[A-Z]?[a-z]+|[A-Z]+|[0-9]+/g)||[]))}function h(n){if(!n)return"";const[e,...t]=m(n);return[e.toLowerCase(),...t.map((n=>n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()))].join("")}function d(n){return m(n).map((n=>n.toLowerCase())).join("-")}function w(n,e){const t="number"==typeof e?e:n.indexOf(e);return t<0||t>=n.length?n:n.slice(0,t)+n[t].toLowerCase()+n.slice(t+1)}function x(n){return n.toString().toLowerCase()}function b(n){return m(n).map((n=>/^[A-Z0-9]+$/.test(n)?n:n.charAt(0).toUpperCase()+n.slice(1).toLowerCase())).join("")}function A(n){return m(n).map((n=>n.toLowerCase())).join("_")}function L(n){return n.toLowerCase().replace(/[_\-]+/g," ").replace(/\b([a-z])([a-z]*)/g,((n,e,t)=>e.toUpperCase()+t))}function O(n,e){const t="number"==typeof e?e:n.indexOf(e);return t<0||t>=n.length?n:n.slice(0,t)+n[t].toUpperCase()+n.slice(t+1)}function y(n){return n.toString().toUpperCase()}function j(n){return n.toString().replace(/^\s+|\s+$/g,"")}function S(n){return n.toString().replace(/\s+$/g,"")}function U(n){return n.toString().replace(/^\s+/g,"")}export{n as capitalizeFirstLetter,e as count,t as findIndex,r as insertAfter,o as insertBefore,i as lowercaseFirstLetter,u as padEnd,c as padStart,s as removeAfter,f as removeAt,a as removeBefore,p as repeat,l as replaceAll,g as reverse,C as substring,h as toCamelCase,d as toKebabCase,w as toLowerAt,x as toLowerCase,b as toPascalCase,A as toSnakeCase,L as toTitleCase,O as toUpperAt,y as toUpperCase,j as trim,S as trimEnd,U as trimStart,m as words};
//# sourceMappingURL=index.esm.js.map