@utilify/string
Advanced tools
| "use strict";function e(e){return/^(?!.*[A-Z]).*[a-z].*$/.test(e.replace(/\s+/g,""))}function t(e){return/^(?!.*[a-z]).*[A-Z].*$/.test(e.replace(/\s+/g,""))}exports.capitalize=function(e){return e.charAt(0).toUpperCase().concat(e.slice(1))},exports.invertCase=function(r){return r.split("").map((r=>e(r)?r.toUpperCase():t(r)?r.toLowerCase():r)).join("")},exports.isLowerCase=e,exports.isUpperCase=t,exports.maskString=function(e,t,r,n){n=Math.min(n,e.length-r);const o=e.slice(0,r),s=e.slice(r+n);return o+t.repeat(n)+s},exports.removeAccents=function(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")},exports.slugify=function(e){return e.trim().replace(/[!@#$%^&*()\-=+[\]{}|\\~;:'",.<>?\/]/g,"").toLowerCase().replace(/\s+/g,"-").normalize("NFD").replace(/[\u0300-\u036f]/g,"")},exports.toCamelCase=function(e){return e.trim().toLowerCase().split(" ").map(((e,t)=>0===t?e:e[0].toUpperCase().concat(e.slice(1)))).join(" ").replace(/\s+/g,"")},exports.toKebabCase=function(e){return e.trim().toLowerCase().replace(/\s+/g,"-")},exports.toPascalCase=function(e){return e.trim().split(" ").map((e=>e[0].toUpperCase().concat(e.slice(1)))).join(" ").replace(/\s+/g,"")},exports.toSnakeCase=function(e){return e.trim().toLowerCase().replace(/\s+/g,"_")},exports.truncate=function(e,t){return e.slice(0,t).concat("...")},exports.wordCount=function(e){return e.trim().replace(/\s+/g," ").split(" ").length}; |
+2
-2
| { | ||
| "name": "@utilify/string", | ||
| "version": "1.0.1", | ||
| "version": "1.0.2", | ||
| "description": "The string utility functions provide a variety of methods for text manipulation, such as transforming, counting words, sanitizing, and formatting strings.", | ||
@@ -32,3 +32,3 @@ "keywords": [ | ||
| "type": "module", | ||
| "main": "dist/index.js", | ||
| "main": "dist/index.cjs", | ||
| "module": "dist/index.js", | ||
@@ -35,0 +35,0 @@ "types": "dist/index.d.ts", |
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
9483
17.49%6
20%26
30%2
100%