js-utils-kit 0.5.3 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var e=require("./array/index.cjs"),r=require("./char/index.cjs"),s=require("./env/index.cjs"),t=require("./file/index.cjs"),i=require("./number/index.cjs"),o=require("./object/index.cjs"),n=require("./string/index.cjs"),p=require("./validate-BKQ-HFTd.js");require("fs"),require("path"),require("events"),require("constants"),require("stream"),require("util"),require("assert"),require("buffer"),require("node:url"),require("node:path"),require("node:fs"),require("node:fs/promises"),require("node:events"),require("node:stream"),require("node:string_decoder"),require("zlib"),exports.array=e.default,exports.all=r.all,exports.char=r.default,exports.digits=r.digits,exports.lowercase=r.lowercase,exports.uppercase=r.uppercase,Object.defineProperty(exports,"Environment",{enumerable:!0,get:function(){return s.Environment}}),exports.env=s.default,exports.getRunTimeEnvironment=s.getRunTimeEnvironment,exports.isBrowser=s.isBrowser,exports.isDev=s.isDev,exports.isNode=s.isNode,exports.isProd=s.isProd,exports.isTest=s.isTest,exports.createArchive=t.createArchive,exports.file=t.default,exports.clamp=i.clamp,exports.getMilliseconds=i.getMilliseconds,exports.isEven=i.isEven,exports.isOdd=i.isOdd,exports.number=i.default,exports.randomFloat=i.randomFloat,exports.randomInt=i.randomInt,exports.isEmptyObject=o.isEmptyObject,exports.isNonEmptyObject=o.isNonEmptyObject,exports.isObject=o.isObject,exports.mergeObj=o.mergeObj,exports.object=o.default,exports.capitalize=n.capitalize,exports.containsWhitespace=n.containsWhitespace,exports.countChars=n.countChars,exports.countFrequencies=n.countFrequencies,exports.countLines=n.countLines,exports.countSubstring=n.countSubstring,exports.countWords=n.countWords,exports.endsWithPunctuation=n.endsWithPunctuation,exports.isAlphabetic=n.isAlphabetic,exports.isCamelCase=n.isCamelCase,exports.isEmail=n.isEmail,exports.isKebabCase=n.isKebabCase,exports.isLowerCase=n.isLowerCase,exports.isNonEmptyString=n.isNonEmptyString,exports.isNumericString=n.isNumericString,exports.isPascalCase=n.isPascalCase,exports.isSnakeCase=n.isSnakeCase,exports.isString=n.isString,exports.isURL=n.isURL,exports.isUpperCase=n.isUpperCase,exports.longestWord=n.longestWord,exports.longestWordLength=n.longestWordLength,exports.padLeft=n.padLeft,exports.padRight=n.padRight,exports.repeatString=n.repeatString,exports.shortestWord=n.shortestWord,exports.shortestWordLength=n.shortestWordLength,exports.splitString=n.splitString,exports.startsWithUppercase=n.startsWithUppercase,exports.string=n.default,exports.stripSymbols=n.stripSymbols,exports.trim=n.trim,exports.truncate=n.truncate,exports.uniqueChars=n.uniqueChars,exports.isArray=p.isArray,exports.isDefined=p.isDefined,exports.isUndefinedOrNull=p.isUndefinedOrNull;
1
+ "use strict";var e=require("./array/index.cjs"),s=require("./char/index.cjs"),t=require("./env/index.cjs"),r=require("./file/index.cjs"),i=require("./number/index.cjs"),o=require("./object/index.cjs"),p=require("./string/index.cjs"),n=require("./validate-BKQ-HFTd.js");require("fs"),require("path"),require("archiver"),exports.array=e.default,exports.all=s.all,exports.char=s.default,exports.digits=s.digits,exports.lowercase=s.lowercase,exports.uppercase=s.uppercase,Object.defineProperty(exports,"Environment",{enumerable:!0,get:function(){return t.Environment}}),exports.env=t.default,exports.getRunTimeEnvironment=t.getRunTimeEnvironment,exports.isBrowser=t.isBrowser,exports.isDev=t.isDev,exports.isNode=t.isNode,exports.isProd=t.isProd,exports.isTest=t.isTest,exports.createArchive=r.createArchive,exports.file=r.default,exports.clamp=i.clamp,exports.getMilliseconds=i.getMilliseconds,exports.isEven=i.isEven,exports.isOdd=i.isOdd,exports.number=i.default,exports.randomFloat=i.randomFloat,exports.randomInt=i.randomInt,exports.isEmptyObject=o.isEmptyObject,exports.isNonEmptyObject=o.isNonEmptyObject,exports.isObject=o.isObject,exports.mergeObj=o.mergeObj,exports.object=o.default,exports.capitalize=p.capitalize,exports.containsWhitespace=p.containsWhitespace,exports.countChars=p.countChars,exports.countFrequencies=p.countFrequencies,exports.countLines=p.countLines,exports.countSubstring=p.countSubstring,exports.countWords=p.countWords,exports.endsWithPunctuation=p.endsWithPunctuation,exports.isAlphabetic=p.isAlphabetic,exports.isCamelCase=p.isCamelCase,exports.isEmail=p.isEmail,exports.isKebabCase=p.isKebabCase,exports.isLowerCase=p.isLowerCase,exports.isNonEmptyString=p.isNonEmptyString,exports.isNumericString=p.isNumericString,exports.isPascalCase=p.isPascalCase,exports.isSnakeCase=p.isSnakeCase,exports.isString=p.isString,exports.isURL=p.isURL,exports.isUpperCase=p.isUpperCase,exports.longestWord=p.longestWord,exports.longestWordLength=p.longestWordLength,exports.padLeft=p.padLeft,exports.padRight=p.padRight,exports.repeatString=p.repeatString,exports.shortestWord=p.shortestWord,exports.shortestWordLength=p.shortestWordLength,exports.splitString=p.splitString,exports.startsWithUppercase=p.startsWithUppercase,exports.string=p.default,exports.stripSymbols=p.stripSymbols,exports.trim=p.trim,exports.truncate=p.truncate,exports.uniqueChars=p.uniqueChars,exports.isArray=n.isArray,exports.isDefined=n.isDefined,exports.isUndefinedOrNull=n.isUndefinedOrNull;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export{default as array}from"./array/index.js";export{all,default as char,digits,lowercase,uppercase}from"./char/index.js";export{Environment,default as env,getRunTimeEnvironment,isBrowser,isDev,isNode,isProd,isTest}from"./env/index.js";export{createArchive,default as file}from"./file/index.js";export{clamp,getMilliseconds,isEven,isOdd,default as number,randomFloat,randomInt}from"./number/index.js";export{isEmptyObject,isNonEmptyObject,isObject,mergeObj,default as object}from"./object/index.js";export{capitalize,containsWhitespace,countChars,countFrequencies,countLines,countSubstring,countWords,endsWithPunctuation,isAlphabetic,isCamelCase,isEmail,isKebabCase,isLowerCase,isNonEmptyString,isNumericString,isPascalCase,isSnakeCase,isString,isURL,isUpperCase,longestWord,longestWordLength,padLeft,padRight,repeatString,shortestWord,shortestWordLength,splitString,startsWithUppercase,default as string,stripSymbols,trim,truncate,uniqueChars}from"./string/index.js";export{i as isArray,a as isDefined,b as isUndefinedOrNull}from"./validate-D9J7otjc.js";import"fs";import"path";import"events";import"constants";import"stream";import"util";import"assert";import"buffer";import"node:url";import"node:path";import"node:fs";import"node:fs/promises";import"node:events";import"node:stream";import"node:string_decoder";import"zlib";
1
+ export{default as array}from"./array/index.js";export{all,default as char,digits,lowercase,uppercase}from"./char/index.js";export{Environment,default as env,getRunTimeEnvironment,isBrowser,isDev,isNode,isProd,isTest}from"./env/index.js";export{createArchive,default as file}from"./file/index.js";export{clamp,getMilliseconds,isEven,isOdd,default as number,randomFloat,randomInt}from"./number/index.js";export{isEmptyObject,isNonEmptyObject,isObject,mergeObj,default as object}from"./object/index.js";export{capitalize,containsWhitespace,countChars,countFrequencies,countLines,countSubstring,countWords,endsWithPunctuation,isAlphabetic,isCamelCase,isEmail,isKebabCase,isLowerCase,isNonEmptyString,isNumericString,isPascalCase,isSnakeCase,isString,isURL,isUpperCase,longestWord,longestWordLength,padLeft,padRight,repeatString,shortestWord,shortestWordLength,splitString,startsWithUppercase,default as string,stripSymbols,trim,truncate,uniqueChars}from"./string/index.js";export{i as isArray,a as isDefined,b as isUndefinedOrNull}from"./validate-D9J7otjc.js";import"fs";import"path";import"archiver";
@@ -1 +1 @@
1
- "use strict";function t(t){return t.replace(/^\w/,t=>t.toUpperCase())}function e(t,e,n=" "){return t.padStart(e,n)}function n(t,e,n=" "){return t.padEnd(e,n)}function r(t,e,n="..."){return e<=0?"":t.length<=e?t:n.length>=e?n.slice(0,e):t.trim().slice(0,e)+n}function s(t,e){return t.repeat(e)}function i(t,e=""){return t.replace(/[^\p{L}\p{N}\s]/gu,e)}function o(t,e=/\s+/){return t.split(e)}function u(t,e){return e?[...t].filter(t=>t===e).length:o(t).length}function a(t){return o(t.trim()).length}function p(t,e){return 0===e.length?0:o(t,e).length-1}function c(t){return[...t].reduce((t,e)=>(t[e]=(t[e]||0)+1,t),{})}function l(t){return t?o(t,/\r\n|\r|\n/).length:0}function h(t){return[...new Set(t)]}function f(t){const e=o(t).map(t=>i(t)).filter(Boolean);return 0===e.length?0:e.reduce((t,e)=>Math.max(t,e.length),0)}function g(t){const e=o(t.trim()).map(t=>i(t)).filter(Boolean);return 0===e.length?0:e.reduce((t,e)=>Math.min(t,e.length),1/0)}function x(t){const e=o(t.trim()).map(t=>i(t)).filter(Boolean);if(0===e.length)return"";const n=Math.max(...e.map(t=>t.length)),r=e.filter(t=>t.length===n),s=[...new Set(r)];return 1===s.length?s[0]:s}function m(t){const e=o(t.trim()).map(t=>i(t)).filter(Boolean);if(0===e.length)return"";const n=Math.min(...e.map(t=>t.length)),r=e.filter(t=>t.length===n),s=[...new Set(r)];return 1===s.length?s[0]:s}Object.defineProperty(exports,"__esModule",{value:!0});const d={function:t=>t.trim(),start:t=>t.trimStart(),end:t=>t.trimEnd(),normalizeWhitespace:t=>t.trim().replace(/\s+/g," ")};function S(t){return null!=t&&"string"==typeof t}function C(t,e=!0){return!!S(t)&&("string"==typeof t&&(e?t.trim().length>0:t.length>0))}function W(t){try{return new URL(t),!0}catch{return!1}}function L(t){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)}function b(t){return/^[a-zA-Z]+$/.test(t)}function z(t){return!isNaN(Number(t))&&!isNaN(parseFloat(t))}function N(t){return/^[A-Z]/.test(t)}function $(t){return/[\p{P}]$/u.test(t)}function y(t){return/\s/.test(t)}function A(t){return/^[a-z][a-zA-Z0-9]*$/.test(t)}function U(t){return/^[A-Z][a-zA-Z0-9]*$/.test(t)}function w(t){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(t)}function E(t){return/^[a-z0-9]+(_[a-z0-9]+)*$/.test(t)}function P(t){return/^[A-Z]+$/.test(t)}function Z(t){return/^[a-z]+$/.test(t)}var M={capitalize:t,splitString:o,countChars:u,countWords:a,countSubstring:p,countFrequencies:c,countLines:l,uniqueChars:h,longestWordLength:f,shortestWordLength:g,longestWord:x,shortestWord:m,padLeft:e,padRight:n,truncate:r,repeatString:s,stripSymbols:i,trim:d,isString:S,isNonEmptyString:C,isURL:W,isEmail:L,isAlphabetic:b,isNumericString:z,startsWithUppercase:N,endsWithPunctuation:$,containsWhitespace:y,isCamelCase:A,isPascalCase:U,isKebabCase:w,isSnakeCase:E,isUpperCase:P,isLowerCase:Z};exports.capitalize=t,exports.containsWhitespace=y,exports.countChars=u,exports.countFrequencies=c,exports.countLines=l,exports.countSubstring=p,exports.countWords=a,exports.default=M,exports.endsWithPunctuation=$,exports.isAlphabetic=b,exports.isCamelCase=A,exports.isEmail=L,exports.isKebabCase=w,exports.isLowerCase=Z,exports.isNonEmptyString=C,exports.isNumericString=z,exports.isPascalCase=U,exports.isSnakeCase=E,exports.isString=S,exports.isURL=W,exports.isUpperCase=P,exports.longestWord=x,exports.longestWordLength=f,exports.padLeft=e,exports.padRight=n,exports.repeatString=s,exports.shortestWord=m,exports.shortestWordLength=g,exports.splitString=o,exports.startsWithUppercase=N,exports.stripSymbols=i,exports.trim=d,exports.truncate=r,exports.uniqueChars=h;
1
+ "use strict";function t(t){return t.replace(/^\w/,t=>t.toUpperCase())}function e(t,e,n=" "){return t.padStart(e,n)}function n(t,e,n=" "){return t.padEnd(e,n)}function r(t,e,n="..."){return e<=0?"":t.length<=e?t:n.length>=e?n.slice(0,e):t.trim().slice(0,e)+n}function s(t,e){return t.repeat(e)}function i(t,e=""){return t.replace(/[^\p{L}\p{N}\s]/gu,e)}function o(t,e=/\s+/){return t.split(e)}function u(t,e){return e?[...t].filter(t=>t===e).length:o(t).length}function a(t){return o(t.trim()).length}function p(t,e){return 0===e.length?0:o(t,e).length-1}function c(t){return[...t].reduce((t,e)=>(t[e]=(t[e]||0)+1,t),{})}function l(t){return t?o(t,/\r\n|\r|\n/).length:0}function h(t){return[...new Set(t)]}function g(t){const e=o(t).map(t=>i(t)).filter(Boolean);return 0===e.length?0:e.reduce((t,e)=>Math.max(t,e.length),0)}function f(t){const e=o(t.trim()).map(t=>i(t)).filter(Boolean);return 0===e.length?0:e.reduce((t,e)=>Math.min(t,e.length),1/0)}function x(t){const e=o(t.trim()).map(t=>i(t)).filter(Boolean);if(0===e.length)return"";const n=Math.max(...e.map(t=>t.length)),r=e.filter(t=>t.length===n),s=[...new Set(r)];return 1===s.length?s[0]:s}function m(t){const e=o(t.trim()).map(t=>i(t)).filter(Boolean);if(0===e.length)return"";const n=Math.min(...e.map(t=>t.length)),r=e.filter(t=>t.length===n),s=[...new Set(r)];return 1===s.length?s[0]:s}Object.defineProperty(exports,"__esModule",{value:!0});const d={function:t=>t.trim(),start:t=>t.trimStart(),end:t=>t.trimEnd(),normalizeWhitespace:t=>t.trim().replace(/\s+/g," ")};function S(t){return null!=t&&"string"==typeof t}function C(t,e=!0){return!!S(t)&&("string"==typeof t&&(e?t.trim().length>0:t.length>0))}function z(t){try{return new URL(t),!0}catch{return!1}}function W(t){if("string"!=typeof t)throw new TypeError("Expected a string");if(t.length>254)return!1;const e=t.split("@");if(2!==e.length)return!1;const[n,r]=e;if(0===n.length||n.length>64)return!1;if(0===r.length||r.length>255)return!1;return!!/^[a-zA-Z0-9_%+-]+(\.[a-zA-Z0-9_%+-]+)*$/.test(n)&&!!/^(?!.*\.\.)(?!-)[A-Za-z0-9-]{1,63}(?<!-)(\.[A-Za-z0-9-]{1,63}(?<!-))*\.[A-Za-z]{2,}$/.test(r)}function L(t){return/^[a-zA-Z]+$/.test(t)}function A(t){return!isNaN(Number(t))&&!isNaN(parseFloat(t))}function b(t){return/^[A-Z]/.test(t)}function Z(t){return/[\p{P}]$/u.test(t)}function y(t){return/\s/.test(t)}function N(t){return/^[a-z][a-zA-Z0-9]*$/.test(t)}function $(t){return/^[A-Z][a-zA-Z0-9]*$/.test(t)}function w(t){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(t)}function E(t){return/^[a-z0-9]+(_[a-z0-9]+)*$/.test(t)}function U(t){return/^[A-Z]+$/.test(t)}function P(t){return/^[a-z]+$/.test(t)}var M={capitalize:t,splitString:o,countChars:u,countWords:a,countSubstring:p,countFrequencies:c,countLines:l,uniqueChars:h,longestWordLength:g,shortestWordLength:f,longestWord:x,shortestWord:m,padLeft:e,padRight:n,truncate:r,repeatString:s,stripSymbols:i,trim:d,isString:S,isNonEmptyString:C,isURL:z,isEmail:W,isAlphabetic:L,isNumericString:A,startsWithUppercase:b,endsWithPunctuation:Z,containsWhitespace:y,isCamelCase:N,isPascalCase:$,isKebabCase:w,isSnakeCase:E,isUpperCase:U,isLowerCase:P};exports.capitalize=t,exports.containsWhitespace=y,exports.countChars=u,exports.countFrequencies=c,exports.countLines=l,exports.countSubstring=p,exports.countWords=a,exports.default=M,exports.endsWithPunctuation=Z,exports.isAlphabetic=L,exports.isCamelCase=N,exports.isEmail=W,exports.isKebabCase=w,exports.isLowerCase=P,exports.isNonEmptyString=C,exports.isNumericString=A,exports.isPascalCase=$,exports.isSnakeCase=E,exports.isString=S,exports.isURL=z,exports.isUpperCase=U,exports.longestWord=x,exports.longestWordLength=g,exports.padLeft=e,exports.padRight=n,exports.repeatString=s,exports.shortestWord=m,exports.shortestWordLength=f,exports.splitString=o,exports.startsWithUppercase=b,exports.stripSymbols=i,exports.trim=d,exports.truncate=r,exports.uniqueChars=h;
@@ -483,11 +483,20 @@ declare function isURL(value: string): boolean;
483
483
  /**
484
484
  * Checks whether a given string is a valid email address.
485
485
  *
486
+ * @remarks
486
487
  * This function uses a practical regular expression to validate email addresses,
487
488
  * allowing most common formats while ignoring edge cases defined by full RFC 5322.
488
489
  * It requires the presence of an `@` symbol and at least one `.` after it.
489
490
  *
491
+ * **Limits enforced**:
492
+ * - Local part (before `@`): 1–64 characters
493
+ * - Domain part (after `@`): 1–255 characters
494
+ * - Total email length: ≤ 254 characters
495
+ *
490
496
  * @param value - The string to validate as an email address.
497
+ *
498
+ * @throws {TypeError} Throws if value is not a string.
499
+ *
491
500
  * @returns - `true` if the string is a valid email; otherwise, `false`.
492
501
  *
493
502
  * @example
@@ -1 +1 @@
1
- function t(t){return t.replace(/^\w/,t=>t.toUpperCase())}function n(t,n,e=" "){return t.padStart(n,e)}function e(t,n,e=" "){return t.padEnd(n,e)}function r(t,n,e="..."){return n<=0?"":t.length<=n?t:e.length>=n?e.slice(0,n):t.trim().slice(0,n)+e}function i(t,n){return t.repeat(n)}function u(t,n=""){return t.replace(/[^\p{L}\p{N}\s]/gu,n)}function s(t,n=/\s+/){return t.split(n)}function o(t,n){return n?[...t].filter(t=>t===n).length:s(t).length}function a(t){return s(t.trim()).length}function c(t,n){return 0===n.length?0:s(t,n).length-1}function l(t){return[...t].reduce((t,n)=>(t[n]=(t[n]||0)+1,t),{})}function f(t){return t?s(t,/\r\n|\r|\n/).length:0}function h(t){return[...new Set(t)]}function g(t){const n=s(t).map(t=>u(t)).filter(Boolean);return 0===n.length?0:n.reduce((t,n)=>Math.max(t,n.length),0)}function p(t){const n=s(t.trim()).map(t=>u(t)).filter(Boolean);return 0===n.length?0:n.reduce((t,n)=>Math.min(t,n.length),1/0)}function m(t){const n=s(t.trim()).map(t=>u(t)).filter(Boolean);if(0===n.length)return"";const e=Math.max(...n.map(t=>t.length)),r=n.filter(t=>t.length===e),i=[...new Set(r)];return 1===i.length?i[0]:i}function d(t){const n=s(t.trim()).map(t=>u(t)).filter(Boolean);if(0===n.length)return"";const e=Math.min(...n.map(t=>t.length)),r=n.filter(t=>t.length===e),i=[...new Set(r)];return 1===i.length?i[0]:i}const S={function:t=>t.trim(),start:t=>t.trimStart(),end:t=>t.trimEnd(),normalizeWhitespace:t=>t.trim().replace(/\s+/g," ")};function z(t){return null!=t&&"string"==typeof t}function C(t,n=!0){return!!z(t)&&("string"==typeof t&&(n?t.trim().length>0:t.length>0))}function W(t){try{return new URL(t),!0}catch{return!1}}function $(t){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)}function L(t){return/^[a-zA-Z]+$/.test(t)}function N(t){return!isNaN(Number(t))&&!isNaN(parseFloat(t))}function A(t){return/^[A-Z]/.test(t)}function b(t){return/[\p{P}]$/u.test(t)}function w(t){return/\s/.test(t)}function Z(t){return/^[a-z][a-zA-Z0-9]*$/.test(t)}function y(t){return/^[A-Z][a-zA-Z0-9]*$/.test(t)}function U(t){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(t)}function B(t){return/^[a-z0-9]+(_[a-z0-9]+)*$/.test(t)}function E(t){return/^[A-Z]+$/.test(t)}function M(t){return/^[a-z]+$/.test(t)}var x={capitalize:t,splitString:s,countChars:o,countWords:a,countSubstring:c,countFrequencies:l,countLines:f,uniqueChars:h,longestWordLength:g,shortestWordLength:p,longestWord:m,shortestWord:d,padLeft:n,padRight:e,truncate:r,repeatString:i,stripSymbols:u,trim:S,isString:z,isNonEmptyString:C,isURL:W,isEmail:$,isAlphabetic:L,isNumericString:N,startsWithUppercase:A,endsWithPunctuation:b,containsWhitespace:w,isCamelCase:Z,isPascalCase:y,isKebabCase:U,isSnakeCase:B,isUpperCase:E,isLowerCase:M};export{t as capitalize,w as containsWhitespace,o as countChars,l as countFrequencies,f as countLines,c as countSubstring,a as countWords,x as default,b as endsWithPunctuation,L as isAlphabetic,Z as isCamelCase,$ as isEmail,U as isKebabCase,M as isLowerCase,C as isNonEmptyString,N as isNumericString,y as isPascalCase,B as isSnakeCase,z as isString,W as isURL,E as isUpperCase,m as longestWord,g as longestWordLength,n as padLeft,e as padRight,i as repeatString,d as shortestWord,p as shortestWordLength,s as splitString,A as startsWithUppercase,u as stripSymbols,S as trim,r as truncate,h as uniqueChars};
1
+ function t(t){return t.replace(/^\w/,t=>t.toUpperCase())}function n(t,n,e=" "){return t.padStart(n,e)}function e(t,n,e=" "){return t.padEnd(n,e)}function r(t,n,e="..."){return n<=0?"":t.length<=n?t:e.length>=n?e.slice(0,n):t.trim().slice(0,n)+e}function i(t,n){return t.repeat(n)}function u(t,n=""){return t.replace(/[^\p{L}\p{N}\s]/gu,n)}function s(t,n=/\s+/){return t.split(n)}function o(t,n){return n?[...t].filter(t=>t===n).length:s(t).length}function a(t){return s(t.trim()).length}function c(t,n){return 0===n.length?0:s(t,n).length-1}function l(t){return[...t].reduce((t,n)=>(t[n]=(t[n]||0)+1,t),{})}function f(t){return t?s(t,/\r\n|\r|\n/).length:0}function h(t){return[...new Set(t)]}function g(t){const n=s(t).map(t=>u(t)).filter(Boolean);return 0===n.length?0:n.reduce((t,n)=>Math.max(t,n.length),0)}function p(t){const n=s(t.trim()).map(t=>u(t)).filter(Boolean);return 0===n.length?0:n.reduce((t,n)=>Math.min(t,n.length),1/0)}function m(t){const n=s(t.trim()).map(t=>u(t)).filter(Boolean);if(0===n.length)return"";const e=Math.max(...n.map(t=>t.length)),r=n.filter(t=>t.length===e),i=[...new Set(r)];return 1===i.length?i[0]:i}function d(t){const n=s(t.trim()).map(t=>u(t)).filter(Boolean);if(0===n.length)return"";const e=Math.min(...n.map(t=>t.length)),r=n.filter(t=>t.length===e),i=[...new Set(r)];return 1===i.length?i[0]:i}const z={function:t=>t.trim(),start:t=>t.trimStart(),end:t=>t.trimEnd(),normalizeWhitespace:t=>t.trim().replace(/\s+/g," ")};function S(t){return null!=t&&"string"==typeof t}function A(t,n=!0){return!!S(t)&&("string"==typeof t&&(n?t.trim().length>0:t.length>0))}function Z(t){try{return new URL(t),!0}catch{return!1}}function C(t){if("string"!=typeof t)throw new TypeError("Expected a string");if(t.length>254)return!1;const n=t.split("@");if(2!==n.length)return!1;const[e,r]=n;if(0===e.length||e.length>64)return!1;if(0===r.length||r.length>255)return!1;return!!/^[a-zA-Z0-9_%+-]+(\.[a-zA-Z0-9_%+-]+)*$/.test(e)&&!!/^(?!.*\.\.)(?!-)[A-Za-z0-9-]{1,63}(?<!-)(\.[A-Za-z0-9-]{1,63}(?<!-))*\.[A-Za-z]{2,}$/.test(r)}function $(t){return/^[a-zA-Z]+$/.test(t)}function W(t){return!isNaN(Number(t))&&!isNaN(parseFloat(t))}function w(t){return/^[A-Z]/.test(t)}function L(t){return/[\p{P}]$/u.test(t)}function N(t){return/\s/.test(t)}function y(t){return/^[a-z][a-zA-Z0-9]*$/.test(t)}function b(t){return/^[A-Z][a-zA-Z0-9]*$/.test(t)}function E(t){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(t)}function U(t){return/^[a-z0-9]+(_[a-z0-9]+)*$/.test(t)}function x(t){return/^[A-Z]+$/.test(t)}function B(t){return/^[a-z]+$/.test(t)}var M={capitalize:t,splitString:s,countChars:o,countWords:a,countSubstring:c,countFrequencies:l,countLines:f,uniqueChars:h,longestWordLength:g,shortestWordLength:p,longestWord:m,shortestWord:d,padLeft:n,padRight:e,truncate:r,repeatString:i,stripSymbols:u,trim:z,isString:S,isNonEmptyString:A,isURL:Z,isEmail:C,isAlphabetic:$,isNumericString:W,startsWithUppercase:w,endsWithPunctuation:L,containsWhitespace:N,isCamelCase:y,isPascalCase:b,isKebabCase:E,isSnakeCase:U,isUpperCase:x,isLowerCase:B};export{t as capitalize,N as containsWhitespace,o as countChars,l as countFrequencies,f as countLines,c as countSubstring,a as countWords,M as default,L as endsWithPunctuation,$ as isAlphabetic,y as isCamelCase,C as isEmail,E as isKebabCase,B as isLowerCase,A as isNonEmptyString,W as isNumericString,b as isPascalCase,U as isSnakeCase,S as isString,Z as isURL,x as isUpperCase,m as longestWord,g as longestWordLength,n as padLeft,e as padRight,i as repeatString,d as shortestWord,p as shortestWordLength,s as splitString,w as startsWithUppercase,u as stripSymbols,z as trim,r as truncate,h as uniqueChars};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "js-utils-kit",
3
3
  "displayName": "JS Utils Kit",
4
- "version": "0.5.3",
4
+ "version": "0.5.4",
5
5
  "description": "Essential JavaScript helpers",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -94,6 +94,7 @@
94
94
  }
95
95
  },
96
96
  "lint-staged": {
97
+ "*.{js,mjs,ts,json,md}": "yarn lint:fix",
97
98
  "*.{js,mjs,ts,json,md,yml}": "yarn format"
98
99
  },
99
100
  "scripts": {
@@ -104,7 +105,7 @@
104
105
  "release": "release-it",
105
106
  "watch": "rollup -c --watch",
106
107
  "lint": "eslint .",
107
- "lint:fix": "npx eslint . --fix",
108
+ "lint:fix": "npx eslint --fix",
108
109
  "format": "prettier --write",
109
110
  "format:check": "prettier --check .",
110
111
  "prepare": "husky",
@@ -113,19 +114,37 @@
113
114
  "gen:exports": "node scripts/gen-exports.js",
114
115
  "gen:indexes": "node scripts/gen-indexes.js"
115
116
  },
117
+ "prettier": {
118
+ "semi": true,
119
+ "singleQuote": true,
120
+ "printWidth": 100,
121
+ "trailingComma": "all",
122
+ "tabWidth": 2
123
+ },
124
+ "jest": {
125
+ "preset": "ts-jest/presets/default-esm",
126
+ "testEnvironment": "node",
127
+ "extensionsToTreatAsEsm": [
128
+ ".ts"
129
+ ],
130
+ "moduleNameMapper": {
131
+ "^(\\.{1,2}/.*)\\.js": "$1"
132
+ }
133
+ },
116
134
  "devDependencies": {
135
+ "@eslint/compat": "^1.4.0",
117
136
  "@eslint/js": "^9.29.0",
118
137
  "@eslint/json": "^0.13.0",
119
138
  "@eslint/markdown": "^7.0.0",
120
139
  "@release-it/conventional-changelog": "^10.0.1",
121
140
  "@rollup/plugin-commonjs": "^28.0.6",
141
+ "@rollup/plugin-json": "^6.1.0",
122
142
  "@rollup/plugin-node-resolve": "^16.0.1",
123
143
  "@rollup/plugin-terser": "^0.4.4",
124
144
  "@rollup/plugin-typescript": "^12.1.3",
125
145
  "@types/archiver": "^6.0.3",
126
146
  "@types/jest": "^30.0.0",
127
147
  "@types/node": "^24.0.4",
128
- "archiver": "^7.0.1",
129
148
  "eslint": "^9.29.0",
130
149
  "globals": "^16.2.0",
131
150
  "husky": "^9.1.7",
@@ -145,6 +164,7 @@
145
164
  "typescript-eslint": "^8.35.0"
146
165
  },
147
166
  "dependencies": {
167
+ "archiver": "^7.0.1",
148
168
  "commander": "^14.0.0",
149
169
  "ora": "^8.2.0"
150
170
  }