@isdk/util 0.1.2 → 0.1.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.d.mts CHANGED
@@ -323,4 +323,22 @@ declare function toPascalCase(str: string): string;
323
323
  */
324
324
  declare function toCamelCase(str: string): string;
325
325
 
326
- export { ConfigFile, DefaultAllTextFiles, type IncludeFiles, type LoadConfigFileOptions, type StringifyFunc, type TraverseFolderHandler, type TraverseFolderSyncHandler, getMultiLevelExtname, glob, isStringIn, normalizeIncludeFiles, parseFrontMatter, parseYaml, registerYamlTag, removeLeadingEmptyLines, stringifyYaml, toCamelCase, toPascalCase, traverseFolder, traverseFolderSync };
326
+ /**
327
+ * Converts a string to capital case, where the first letter of each word is capitalized
328
+ * and the rest are in lowercase. Words are separated by spaces, hyphens, or underscores.
329
+ *
330
+ * @param str - The input string to convert.
331
+ * @returns The converted string in capital case.
332
+ *
333
+ * @example
334
+ * ```typescript
335
+ * toCapitalCase('hello world'); // Returns 'Hello World'
336
+ * toCapitalCase('HELLO-WORLD'); // Returns 'Hello World'
337
+ * toCapitalCase('hello_world'); // Returns 'Hello World'
338
+ * toCapitalCase('hElLo_wOrLd-TeSt cAsE'); // Returns 'H El Lo W Or Ld Te St C As E'
339
+ * toCapitalCase(''); // Returns ''
340
+ * ```
341
+ */
342
+ declare function toCapitalCase(str: string): string;
343
+
344
+ export { ConfigFile, DefaultAllTextFiles, type IncludeFiles, type LoadConfigFileOptions, type StringifyFunc, type TraverseFolderHandler, type TraverseFolderSyncHandler, getMultiLevelExtname, glob, isStringIn, normalizeIncludeFiles, parseFrontMatter, parseYaml, registerYamlTag, removeLeadingEmptyLines, stringifyYaml, toCamelCase, toCapitalCase, toPascalCase, traverseFolder, traverseFolderSync };
package/dist/index.d.ts CHANGED
@@ -323,4 +323,22 @@ declare function toPascalCase(str: string): string;
323
323
  */
324
324
  declare function toCamelCase(str: string): string;
325
325
 
326
- export { ConfigFile, DefaultAllTextFiles, type IncludeFiles, type LoadConfigFileOptions, type StringifyFunc, type TraverseFolderHandler, type TraverseFolderSyncHandler, getMultiLevelExtname, glob, isStringIn, normalizeIncludeFiles, parseFrontMatter, parseYaml, registerYamlTag, removeLeadingEmptyLines, stringifyYaml, toCamelCase, toPascalCase, traverseFolder, traverseFolderSync };
326
+ /**
327
+ * Converts a string to capital case, where the first letter of each word is capitalized
328
+ * and the rest are in lowercase. Words are separated by spaces, hyphens, or underscores.
329
+ *
330
+ * @param str - The input string to convert.
331
+ * @returns The converted string in capital case.
332
+ *
333
+ * @example
334
+ * ```typescript
335
+ * toCapitalCase('hello world'); // Returns 'Hello World'
336
+ * toCapitalCase('HELLO-WORLD'); // Returns 'Hello World'
337
+ * toCapitalCase('hello_world'); // Returns 'Hello World'
338
+ * toCapitalCase('hElLo_wOrLd-TeSt cAsE'); // Returns 'H El Lo W Or Ld Te St C As E'
339
+ * toCapitalCase(''); // Returns ''
340
+ * ```
341
+ */
342
+ declare function toCapitalCase(str: string): string;
343
+
344
+ export { ConfigFile, DefaultAllTextFiles, type IncludeFiles, type LoadConfigFileOptions, type StringifyFunc, type TraverseFolderHandler, type TraverseFolderSyncHandler, getMultiLevelExtname, glob, isStringIn, normalizeIncludeFiles, parseFrontMatter, parseYaml, registerYamlTag, removeLeadingEmptyLines, stringifyYaml, toCamelCase, toCapitalCase, toPascalCase, traverseFolder, traverseFolderSync };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.create,r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,i=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,a=(e,t,i,a)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let f of o(t))s.call(e,f)||f===i||r(e,f,{get:()=>t[f],enumerable:!(a=n(t,f))||a.enumerable});return e},f=(e,n,o)=>(o=null!=e?t(i(e)):{},a(!n&&e&&e.__esModule?o:r(o,"default",{value:e,enumerable:!0}),e)),u={};((e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})})(u,{ConfigFile:()=>F,DefaultAllTextFiles:()=>A,getMultiLevelExtname:()=>y,glob:()=>T,isStringIn:()=>k,normalizeIncludeFiles:()=>L,parseFrontMatter:()=>q,parseYaml:()=>d,registerYamlTag:()=>b,removeLeadingEmptyLines:()=>j,stringifyYaml:()=>h,toCamelCase:()=>$,toPascalCase:()=>Y,traverseFolder:()=>E,traverseFolderSync:()=>M}),module.exports=(e=u,a(r({},"__esModule",{value:!0}),e));var c=require("fs"),l=f(require("path")),m=require("load-config-file"),p=f(require("path"));function y(e,t=1){let r="";for(;t--;){const t=p.default.extname(e);if(!t)break;r=t+r,e=p.default.basename(e,t)}return r}var v=require("yaml"),g=[];function b(e){Array.isArray(e)||(e=[e]);for(const t of e){-1===g.indexOf(t)&&g.push(t)}}function d(e,t){if(t)if(t.customTags){if(Array.isArray(t.customTags))t.customTags=g.concat(t.customTags);else if("function"==typeof t.customTags){const e=t.customTags;t.customTags=t=>e(g.concat(t))}}else t.customTags=g;else t={customTags:g};return(0,v.parse)(e,t)}function h(e,t){if(t)if(t.customTags){if(Array.isArray(t.customTags))t.customTags=g.concat(t.customTags);else if("function"==typeof t.customTags){const e=t.customTags;t.customTags=t=>e(g.concat(t))}}else t.customTags=g;else t={customTags:g};return(0,v.stringify)(e,t)}function j(e){const t=/^\s*(#[^\r\n]*)?[\r\n]+/;let r;for(;null!==(r=t.exec(e))&&((e=e.substring(r[0].length)).startsWith("\n")||e.startsWith("\r")||e.trimStart().startsWith("#")););return e}var x="---";function q(e,t=x){const r=t.length,n=j(e);if(n.startsWith(t)&&("\n"===n[t.length]||"\r"===n[t.length])){let e=n.indexOf("\n"+t,r);if(-1!==e){const o=n.slice(r,e);for(e+=t.length+1;"\n"===n[e]||"\r"===n[e];)e++;const i=n.slice(e);return{data:d(o)||{},content:i}}}return{data:{},content:e}}var F=class{static register(e,t,r){m.Config.register(e,t),"string"==typeof e&&(e=[e]);for(const t of e)this.stringifys[t]=r}static load(e,t){return function(e,{extLevel:t=1,externalFile:r}={}){"."===e[0]&&t++;const n=y(e,t);n&&n.split(".").length>1&&(e=e.slice(0,-n.length));let o=m.Config.loadSync(e);if(!o&&r){if(!l.default.isAbsolute(r)){const t=l.default.dirname(e);r=l.default.join(t,r)}if((0,c.existsSync)(r)){const e=q((0,c.readFileSync)(r,"utf8")).data;Object.keys(e).length&&(o=e)}}return o}(e,t)}static save(e,t,r){return function(e,t,{extLevel:r=1}={}){"."===e[0]&&r++;let n=y(e,r);(!n||n.split(".").length<=1)&&(e+=".yaml",n=".yaml");const o=F.stringifys[n];if(!o)throw new Error(`${e} unsupported mime type: ${n}`);t=o(t);const i=l.default.dirname(e);(0,c.existsSync)(i)||(0,c.mkdirSync)(i,{recursive:!0});return(0,c.writeFileSync)(e,t,{encoding:"utf8"}),e}(e,t,r)}};F.stringifys={},F.register([".yml",".yaml"],d,h),F.register([".json"],(function(e){return JSON.parse(e)}),(e=>JSON.stringify(e,null,2)));var O=require("@isdk/glob"),w=f(require("path"));function T(e,t,r){return r&&(e=w.default.relative(r,e)),(0,O.globMatch)(e,t)}function k(e,t){return"string"==typeof t&&(t=[t]),-1!==t.indexOf(e)}var A=["**/*.((j|t)s?(x)|m(j|t)s)?(x)","**/*.(md|markdown|txt|?(x)htm?(l)|yaml|yml|xml|json|bat|sh|bash|zsh|ini|css|scss|less|sass|py|rb|php|go|java|c|cpp|h|hpp|hxx|rust|zig)"];function L(e,t=A){if(e)if(Array.isArray(e))e=[...e];else{const r=e.include||[],n=e.exclude||[];0===r.length&&r.push(...t),e=[...r];for(const t of n)e.push(`!${t}`)}else e=[...t];return 0===e.length&&e.push(...t),e}var C=require("fs/promises"),S=require("fs"),z=f(require("path"));async function E(e,t){const r=await(0,C.readdir)(e,{withFileTypes:!0,recursive:!0});for(const n of r){const r=z.default.join(e,n.name);if(!0===await t(r,n))break}}function M(e,t){const r=(0,S.readdirSync)(e,{withFileTypes:!0,recursive:!0});for(const n of r){if(!0===t(z.default.join(e,n.name),n))break}}function Y(e){if(!e)return"";return e.replace(/[-_ ]+/g," ").split(" ").filter(Boolean).map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join("")}function $(e){return(e=Y(e)).charAt(0).toLowerCase()+e.slice(1)}
1
+ "use strict";var e,t=Object.create,r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,i=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,a=(e,t,i,a)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let f of o(t))s.call(e,f)||f===i||r(e,f,{get:()=>t[f],enumerable:!(a=n(t,f))||a.enumerable});return e},f=(e,n,o)=>(o=null!=e?t(i(e)):{},a(!n&&e&&e.__esModule?o:r(o,"default",{value:e,enumerable:!0}),e)),u={};((e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})})(u,{ConfigFile:()=>w,DefaultAllTextFiles:()=>T,getMultiLevelExtname:()=>y,glob:()=>A,isStringIn:()=>C,normalizeIncludeFiles:()=>k,parseFrontMatter:()=>q,parseYaml:()=>d,registerYamlTag:()=>b,removeLeadingEmptyLines:()=>j,stringifyYaml:()=>h,toCamelCase:()=>M,toCapitalCase:()=>Y,toPascalCase:()=>E,traverseFolder:()=>S,traverseFolderSync:()=>_}),module.exports=(e=u,a(r({},"__esModule",{value:!0}),e));var l=require("fs"),c=f(require("path")),m=require("load-config-file"),p=f(require("path"));function y(e,t=1){let r="";for(;t--;){const t=p.default.extname(e);if(!t)break;r=t+r,e=p.default.basename(e,t)}return r}var g=require("yaml"),v=[];function b(e){Array.isArray(e)||(e=[e]);for(const t of e){-1===v.indexOf(t)&&v.push(t)}}function d(e,t){if(t)if(t.customTags){if(Array.isArray(t.customTags))t.customTags=v.concat(t.customTags);else if("function"==typeof t.customTags){const e=t.customTags;t.customTags=t=>e(v.concat(t))}}else t.customTags=v;else t={customTags:v};return(0,g.parse)(e,t)}function h(e,t){if(t)if(t.customTags){if(Array.isArray(t.customTags))t.customTags=v.concat(t.customTags);else if("function"==typeof t.customTags){const e=t.customTags;t.customTags=t=>e(v.concat(t))}}else t.customTags=v;else t={customTags:v};return(0,g.stringify)(e,t)}function j(e){const t=/^\s*(#[^\r\n]*)?[\r\n]+/;let r;for(;null!==(r=t.exec(e))&&((e=e.substring(r[0].length)).startsWith("\n")||e.startsWith("\r")||e.trimStart().startsWith("#")););return e}var x="---";function q(e,t=x){const r=t.length,n=j(e);if(n.startsWith(t)&&("\n"===n[t.length]||"\r"===n[t.length])){let e=n.indexOf("\n"+t,r);if(-1!==e){const o=n.slice(r,e);for(e+=t.length+1;"\n"===n[e]||"\r"===n[e];)e++;const i=n.slice(e);return{data:d(o)||{},content:i}}}return{data:{},content:e}}var w=class{static register(e,t,r){m.Config.register(e,t),"string"==typeof e&&(e=[e]);for(const t of e)this.stringifys[t]=r}static load(e,t){return function(e,{extLevel:t=1,externalFile:r}={}){"."===e[0]&&t++;const n=y(e,t);n&&n.split(".").length>1&&(e=e.slice(0,-n.length));let o=m.Config.loadSync(e);if(!o&&r){if(!c.default.isAbsolute(r)){const t=c.default.dirname(e);r=c.default.join(t,r)}if((0,l.existsSync)(r)){const e=q((0,l.readFileSync)(r,"utf8")).data;Object.keys(e).length&&(o=e)}}return o}(e,t)}static save(e,t,r){return function(e,t,{extLevel:r=1}={}){"."===e[0]&&r++;let n=y(e,r);(!n||n.split(".").length<=1)&&(e+=".yaml",n=".yaml");const o=w.stringifys[n];if(!o)throw new Error(`${e} unsupported mime type: ${n}`);t=o(t);const i=c.default.dirname(e);(0,l.existsSync)(i)||(0,l.mkdirSync)(i,{recursive:!0});return(0,l.writeFileSync)(e,t,{encoding:"utf8"}),e}(e,t,r)}};w.stringifys={},w.register([".yml",".yaml"],d,h),w.register([".json"],(function(e){return JSON.parse(e)}),(e=>JSON.stringify(e,null,2)));var F=require("@isdk/glob"),O=f(require("path"));function A(e,t,r){return r&&(e=O.default.relative(r,e)),(0,F.globMatch)(e,t)}function C(e,t){return"string"==typeof t&&(t=[t]),-1!==t.indexOf(e)}var T=["**/*.((j|t)s?(x)|m(j|t)s)?(x)","**/*.(md|markdown|txt|?(x)htm?(l)|yaml|yml|xml|json|bat|sh|bash|zsh|ini|css|scss|less|sass|py|rb|php|go|java|c|cpp|h|hpp|hxx|rust|zig)"];function k(e,t=T){if(e)if(Array.isArray(e))e=[...e];else{const r=e.include||[],n=e.exclude||[];0===r.length&&r.push(...t),e=[...r];for(const t of n)e.push(`!${t}`)}else e=[...t];return 0===e.length&&e.push(...t),e}var L=require("fs/promises"),$=require("fs"),z=f(require("path"));async function S(e,t){const r=await(0,L.readdir)(e,{withFileTypes:!0});for(const n of r){const r=z.default.join(e,n.name);if(n.isDirectory()){await t(r,n)||await S(r,t)}else{if(!0===await t(r,n))break}}}function _(e,t){const r=(0,$.readdirSync)(e,{withFileTypes:!0});for(const n of r){const r=z.default.join(e,n.name);if(n.isDirectory()){t(r,n)||S(r,t)}else{if(!0===t(r,n))break}}}function E(e){if(!e)return"";return e.replace(/[-_ ]+/g," ").split(" ").filter(Boolean).map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join("")}function M(e){return(e=E(e)).charAt(0).toLowerCase()+e.slice(1)}function Y(e){if(!e)return"";return e.replace(/[-_ ]+/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").split(" ").filter(Boolean).map((e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase())).join(" ")}
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{existsSync as t,mkdirSync as r,readFileSync as n,writeFileSync as o}from"fs";import e from"path";import{Config as s}from"load-config-file";import i from"path";function f(t,r=1){let n="";for(;r--;){const r=i.extname(t);if(!r)break;n=r+n,t=i.basename(t,r)}return n}import{parse as c,stringify as u}from"yaml";var a=[];function l(t){Array.isArray(t)||(t=[t]);for(const r of t){-1===a.indexOf(r)&&a.push(r)}}function m(t,r){if(r)if(r.customTags){if(Array.isArray(r.customTags))r.customTags=a.concat(r.customTags);else if("function"==typeof r.customTags){const t=r.customTags;r.customTags=r=>t(a.concat(r))}}else r.customTags=a;else r={customTags:a};return c(t,r)}function p(t,r){if(r)if(r.customTags){if(Array.isArray(r.customTags))r.customTags=a.concat(r.customTags);else if("function"==typeof r.customTags){const t=r.customTags;r.customTags=r=>t(a.concat(r))}}else r.customTags=a;else r={customTags:a};return u(t,r)}function y(t){const r=/^\s*(#[^\r\n]*)?[\r\n]+/;let n;for(;null!==(n=r.exec(t))&&((t=t.substring(n[0].length)).startsWith("\n")||t.startsWith("\r")||t.trimStart().startsWith("#")););return t}function h(t,r="---"){const n=r.length,o=y(t);if(o.startsWith(r)&&("\n"===o[r.length]||"\r"===o[r.length])){let t=o.indexOf("\n"+r,n);if(-1!==t){const e=o.slice(n,t);for(t+=r.length+1;"\n"===o[t]||"\r"===o[t];)t++;const s=o.slice(t);return{data:m(e)||{},content:s}}}return{data:{},content:t}}var g=class{static register(t,r,n){s.register(t,r),"string"==typeof t&&(t=[t]);for(const r of t)this.stringifys[r]=n}static load(r,o){return function(r,{extLevel:o=1,externalFile:i}={}){"."===r[0]&&o++;const c=f(r,o);c&&c.split(".").length>1&&(r=r.slice(0,-c.length));let u=s.loadSync(r);if(!u&&i){if(!e.isAbsolute(i)){const t=e.dirname(r);i=e.join(t,i)}if(t(i)){const t=h(n(i,"utf8")).data;Object.keys(t).length&&(u=t)}}return u}(r,o)}static save(n,s,i){return function(n,s,{extLevel:i=1}={}){"."===n[0]&&i++;let c=f(n,i);(!c||c.split(".").length<=1)&&(n+=".yaml",c=".yaml");const u=g.stringifys[c];if(!u)throw new Error(`${n} unsupported mime type: ${c}`);s=u(s);const a=e.dirname(n);t(a)||r(a,{recursive:!0});return o(n,s,{encoding:"utf8"}),n}(n,s,i)}};g.stringifys={},g.register([".yml",".yaml"],m,p),g.register([".json"],(function(t){return JSON.parse(t)}),(t=>JSON.stringify(t,null,2)));import{globMatch as x}from"@isdk/glob";import v from"path";function d(t,r,n){return n&&(t=v.relative(n,t)),x(t,r)}function b(t,r){return"string"==typeof r&&(r=[r]),-1!==r.indexOf(t)}var w=["**/*.((j|t)s?(x)|m(j|t)s)?(x)","**/*.(md|markdown|txt|?(x)htm?(l)|yaml|yml|xml|json|bat|sh|bash|zsh|ini|css|scss|less|sass|py|rb|php|go|java|c|cpp|h|hpp|hxx|rust|zig)"];function j(t,r=w){if(t)if(Array.isArray(t))t=[...t];else{const n=t.include||[],o=t.exclude||[];0===n.length&&n.push(...r),t=[...n];for(const r of o)t.push(`!${r}`)}else t=[...r];return 0===t.length&&t.push(...r),t}import{readdir as k}from"fs/promises";import{readdirSync as A}from"fs";import T from"path";async function F(t,r){const n=await k(t,{withFileTypes:!0,recursive:!0});for(const o of n){const n=T.join(t,o.name);if(!0===await r(n,o))break}}function O(t,r){const n=A(t,{withFileTypes:!0,recursive:!0});for(const o of n){if(!0===r(T.join(t,o.name),o))break}}function $(t){if(!t)return"";return t.replace(/[-_ ]+/g," ").split(" ").filter(Boolean).map((t=>t.charAt(0).toUpperCase()+t.slice(1))).join("")}function z(t){return(t=$(t)).charAt(0).toLowerCase()+t.slice(1)}export{g as ConfigFile,w as DefaultAllTextFiles,f as getMultiLevelExtname,d as glob,b as isStringIn,j as normalizeIncludeFiles,h as parseFrontMatter,m as parseYaml,l as registerYamlTag,y as removeLeadingEmptyLines,p as stringifyYaml,z as toCamelCase,$ as toPascalCase,F as traverseFolder,O as traverseFolderSync};
1
+ import{existsSync as t,mkdirSync as n,readFileSync as r,writeFileSync as o}from"fs";import e from"path";import{Config as i}from"load-config-file";import f from"path";function s(t,n=1){let r="";for(;n--;){const n=f.extname(t);if(!n)break;r=n+r,t=f.basename(t,n)}return r}import{parse as c,stringify as a}from"yaml";var u=[];function l(t){Array.isArray(t)||(t=[t]);for(const n of t){-1===u.indexOf(n)&&u.push(n)}}function m(t,n){if(n)if(n.customTags){if(Array.isArray(n.customTags))n.customTags=u.concat(n.customTags);else if("function"==typeof n.customTags){const t=n.customTags;n.customTags=n=>t(u.concat(n))}}else n.customTags=u;else n={customTags:u};return c(t,n)}function p(t,n){if(n)if(n.customTags){if(Array.isArray(n.customTags))n.customTags=u.concat(n.customTags);else if("function"==typeof n.customTags){const t=n.customTags;n.customTags=n=>t(u.concat(n))}}else n.customTags=u;else n={customTags:u};return a(t,n)}function y(t){const n=/^\s*(#[^\r\n]*)?[\r\n]+/;let r;for(;null!==(r=n.exec(t))&&((t=t.substring(r[0].length)).startsWith("\n")||t.startsWith("\r")||t.trimStart().startsWith("#")););return t}function h(t,n="---"){const r=n.length,o=y(t);if(o.startsWith(n)&&("\n"===o[n.length]||"\r"===o[n.length])){let t=o.indexOf("\n"+n,r);if(-1!==t){const e=o.slice(r,t);for(t+=n.length+1;"\n"===o[t]||"\r"===o[t];)t++;const i=o.slice(t);return{data:m(e)||{},content:i}}}return{data:{},content:t}}var g=class{static register(t,n,r){i.register(t,n),"string"==typeof t&&(t=[t]);for(const n of t)this.stringifys[n]=r}static load(n,o){return function(n,{extLevel:o=1,externalFile:f}={}){"."===n[0]&&o++;const c=s(n,o);c&&c.split(".").length>1&&(n=n.slice(0,-c.length));let a=i.loadSync(n);if(!a&&f){if(!e.isAbsolute(f)){const t=e.dirname(n);f=e.join(t,f)}if(t(f)){const t=h(r(f,"utf8")).data;Object.keys(t).length&&(a=t)}}return a}(n,o)}static save(r,i,f){return function(r,i,{extLevel:f=1}={}){"."===r[0]&&f++;let c=s(r,f);(!c||c.split(".").length<=1)&&(r+=".yaml",c=".yaml");const a=g.stringifys[c];if(!a)throw new Error(`${r} unsupported mime type: ${c}`);i=a(i);const u=e.dirname(r);t(u)||n(u,{recursive:!0});return o(r,i,{encoding:"utf8"}),r}(r,i,f)}};g.stringifys={},g.register([".yml",".yaml"],m,p),g.register([".json"],(function(t){return JSON.parse(t)}),(t=>JSON.stringify(t,null,2)));import{globMatch as x}from"@isdk/glob";import d from"path";function w(t,n,r){return r&&(t=d.relative(r,t)),x(t,n)}function b(t,n){return"string"==typeof n&&(n=[n]),-1!==n.indexOf(t)}var v=["**/*.((j|t)s?(x)|m(j|t)s)?(x)","**/*.(md|markdown|txt|?(x)htm?(l)|yaml|yml|xml|json|bat|sh|bash|zsh|ini|css|scss|less|sass|py|rb|php|go|java|c|cpp|h|hpp|hxx|rust|zig)"];function j(t,n=v){if(t)if(Array.isArray(t))t=[...t];else{const r=t.include||[],o=t.exclude||[];0===r.length&&r.push(...n),t=[...r];for(const n of o)t.push(`!${n}`)}else t=[...n];return 0===t.length&&t.push(...n),t}import{readdir as k}from"fs/promises";import{readdirSync as A}from"fs";import $ from"path";async function T(t,n){const r=await k(t,{withFileTypes:!0});for(const o of r){const r=$.join(t,o.name);if(o.isDirectory()){await n(r,o)||await T(r,n)}else{if(!0===await n(r,o))break}}}function z(t,n){const r=A(t,{withFileTypes:!0});for(const o of r){const r=$.join(t,o.name);if(o.isDirectory()){n(r,o)||T(r,n)}else{if(!0===n(r,o))break}}}function F(t){if(!t)return"";return t.replace(/[-_ ]+/g," ").split(" ").filter(Boolean).map((t=>t.charAt(0).toUpperCase()+t.slice(1))).join("")}function O(t){return(t=F(t)).charAt(0).toLowerCase()+t.slice(1)}function B(t){if(!t)return"";return t.replace(/[-_ ]+/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").split(" ").filter(Boolean).map((t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase())).join(" ")}export{g as ConfigFile,v as DefaultAllTextFiles,s as getMultiLevelExtname,w as glob,b as isStringIn,j as normalizeIncludeFiles,h as parseFrontMatter,m as parseYaml,l as registerYamlTag,y as removeLeadingEmptyLines,p as stringifyYaml,O as toCamelCase,B as toCapitalCase,F as toPascalCase,T as traverseFolder,z as traverseFolderSync};
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Class: ConfigFile
8
8
 
9
- Defined in: [config-file.ts:46](https://github.com/isdk/util.js/blob/79fcdde5490ce675c34a8f772113e8a202beea65/src/config-file.ts#L46)
9
+ Defined in: [config-file.ts:46](https://github.com/isdk/util.js/blob/f467c507a8cfd31890519496ac9059c8ad3f8d03/src/config-file.ts#L46)
10
10
 
11
11
  Represents a configuration file utility class that provides methods to load and save configuration files.
12
12
  It supports multiple file formats such as YAML, JSON, etc., by registering corresponding parsers and stringifiers.
@@ -45,7 +45,7 @@ console.log(config); // Output: { key: 'value' }
45
45
 
46
46
  > `static` **stringifys**: `Record`\<`string`, [`StringifyFunc`](../type-aliases/StringifyFunc.md)\> = `{}`
47
47
 
48
- Defined in: [config-file.ts:50](https://github.com/isdk/util.js/blob/79fcdde5490ce675c34a8f772113e8a202beea65/src/config-file.ts#L50)
48
+ Defined in: [config-file.ts:50](https://github.com/isdk/util.js/blob/f467c507a8cfd31890519496ac9059c8ad3f8d03/src/config-file.ts#L50)
49
49
 
50
50
  A record of registered stringify functions for different file extensions.
51
51
 
@@ -55,7 +55,7 @@ A record of registered stringify functions for different file extensions.
55
55
 
56
56
  > `static` **load**(`filename`, `options`?): `any`
57
57
 
58
- Defined in: [config-file.ts:85](https://github.com/isdk/util.js/blob/79fcdde5490ce675c34a8f772113e8a202beea65/src/config-file.ts#L85)
58
+ Defined in: [config-file.ts:85](https://github.com/isdk/util.js/blob/f467c507a8cfd31890519496ac9059c8ad3f8d03/src/config-file.ts#L85)
59
59
 
60
60
  Loads a configuration file based on the provided filename and options.
61
61
 
@@ -92,7 +92,7 @@ console.log(config); // Output: { key: 'value' }
92
92
 
93
93
  > `static` **register**(`extname`, `parser`, `stringify`): `void`
94
94
 
95
- Defined in: [config-file.ts:64](https://github.com/isdk/util.js/blob/79fcdde5490ce675c34a8f772113e8a202beea65/src/config-file.ts#L64)
95
+ Defined in: [config-file.ts:64](https://github.com/isdk/util.js/blob/f467c507a8cfd31890519496ac9059c8ad3f8d03/src/config-file.ts#L64)
96
96
 
97
97
  Registers a parser and stringifier for specific file extensions.
98
98
 
@@ -132,7 +132,7 @@ ConfigFile.register(['.json'], JSON.parse, (obj) => JSON.stringify(obj, null, 2)
132
132
 
133
133
  > `static` **save**(`filename`, `config`, `options`?): `string`
134
134
 
135
- Defined in: [config-file.ts:102](https://github.com/isdk/util.js/blob/79fcdde5490ce675c34a8f772113e8a202beea65/src/config-file.ts#L102)
135
+ Defined in: [config-file.ts:102](https://github.com/isdk/util.js/blob/f467c507a8cfd31890519496ac9059c8ad3f8d03/src/config-file.ts#L102)
136
136
 
137
137
  Saves a configuration object to a file with the specified filename and options.
138
138
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **getMultiLevelExtname**(`filename`, `level`): `string`
10
10
 
11
- Defined in: [get-multi-level-extname.ts:9](https://github.com/isdk/util.js/blob/79fcdde5490ce675c34a8f772113e8a202beea65/src/get-multi-level-extname.ts#L9)
11
+ Defined in: [get-multi-level-extname.ts:9](https://github.com/isdk/util.js/blob/f467c507a8cfd31890519496ac9059c8ad3f8d03/src/get-multi-level-extname.ts#L9)
12
12
 
13
13
  Retrieves multi-level file extension
14
14
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **glob**(`filepath`, `pattern`, `rootDir`?): `undefined` \| `boolean`
10
10
 
11
- Defined in: [glob.ts:29](https://github.com/isdk/util.js/blob/79fcdde5490ce675c34a8f772113e8a202beea65/src/glob.ts#L29)
11
+ Defined in: [glob.ts:29](https://github.com/isdk/util.js/blob/f467c507a8cfd31890519496ac9059c8ad3f8d03/src/glob.ts#L29)
12
12
 
13
13
  Matches a file path against a list of glob patterns.
14
14
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **isStringIn**(`str`, `arr`): `boolean`
10
10
 
11
- Defined in: [is-string-in.ts:17](https://github.com/isdk/util.js/blob/79fcdde5490ce675c34a8f772113e8a202beea65/src/is-string-in.ts#L17)
11
+ Defined in: [is-string-in.ts:17](https://github.com/isdk/util.js/blob/f467c507a8cfd31890519496ac9059c8ad3f8d03/src/is-string-in.ts#L17)
12
12
 
13
13
  Checks if a given string exists within an array of strings or a single string.
14
14
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **normalizeIncludeFiles**(`files`?, `defaultFiles`?): `string`[]
10
10
 
11
- Defined in: [include-files.ts:34](https://github.com/isdk/util.js/blob/79fcdde5490ce675c34a8f772113e8a202beea65/src/include-files.ts#L34)
11
+ Defined in: [include-files.ts:34](https://github.com/isdk/util.js/blob/f467c507a8cfd31890519496ac9059c8ad3f8d03/src/include-files.ts#L34)
12
12
 
13
13
  Normalizes a list of file patterns for glob matching.
14
14
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **parseFrontMatter**(`value`, `delimiter`): `object`
10
10
 
11
- Defined in: [front-matter.ts:6](https://github.com/isdk/util.js/blob/79fcdde5490ce675c34a8f772113e8a202beea65/src/front-matter.ts#L6)
11
+ Defined in: [front-matter.ts:6](https://github.com/isdk/util.js/blob/f467c507a8cfd31890519496ac9059c8ad3f8d03/src/front-matter.ts#L6)
12
12
 
13
13
  ## Parameters
14
14
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **parseYaml**(`content`, `options`?): `any`
10
10
 
11
- Defined in: [yaml.ts:51](https://github.com/isdk/util.js/blob/79fcdde5490ce675c34a8f772113e8a202beea65/src/yaml.ts#L51)
11
+ Defined in: [yaml.ts:51](https://github.com/isdk/util.js/blob/f467c507a8cfd31890519496ac9059c8ad3f8d03/src/yaml.ts#L51)
12
12
 
13
13
  Parses a YAML string into a JavaScript object with optional custom tags.
14
14
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **registerYamlTag**(`tags`): `void`
10
10
 
11
- Defined in: [yaml.ts:23](https://github.com/isdk/util.js/blob/79fcdde5490ce675c34a8f772113e8a202beea65/src/yaml.ts#L23)
11
+ Defined in: [yaml.ts:23](https://github.com/isdk/util.js/blob/f467c507a8cfd31890519496ac9059c8ad3f8d03/src/yaml.ts#L23)
12
12
 
13
13
  Registers custom YAML tags to be used in parsing and stringifying YAML content.
14
14
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **removeLeadingEmptyLines**(`text`): `string`
10
10
 
11
- Defined in: [remove-leading-empty-lines.ts:16](https://github.com/isdk/util.js/blob/79fcdde5490ce675c34a8f772113e8a202beea65/src/remove-leading-empty-lines.ts#L16)
11
+ Defined in: [remove-leading-empty-lines.ts:16](https://github.com/isdk/util.js/blob/f467c507a8cfd31890519496ac9059c8ad3f8d03/src/remove-leading-empty-lines.ts#L16)
12
12
 
13
13
  Removes all leading empty lines or "#" comments line from the given string.
14
14
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **stringifyYaml**(`content`, `options`?): `string`
10
10
 
11
- Defined in: [yaml.ts:85](https://github.com/isdk/util.js/blob/79fcdde5490ce675c34a8f772113e8a202beea65/src/yaml.ts#L85)
11
+ Defined in: [yaml.ts:85](https://github.com/isdk/util.js/blob/f467c507a8cfd31890519496ac9059c8ad3f8d03/src/yaml.ts#L85)
12
12
 
13
13
  Converts a JavaScript object into a YAML string with optional custom tags.
14
14
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **toCamelCase**(`str`): `string`
10
10
 
11
- Defined in: [to-camel-case.ts:17](https://github.com/isdk/util.js/blob/79fcdde5490ce675c34a8f772113e8a202beea65/src/to-camel-case.ts#L17)
11
+ Defined in: [to-camel-case.ts:17](https://github.com/isdk/util.js/blob/f467c507a8cfd31890519496ac9059c8ad3f8d03/src/to-camel-case.ts#L17)
12
12
 
13
13
  Converts a string to camelCase.
14
14
 
@@ -0,0 +1,38 @@
1
+ [**@isdk/util**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/util](../globals.md) / toCapitalCase
6
+
7
+ # Function: toCapitalCase()
8
+
9
+ > **toCapitalCase**(`str`): `string`
10
+
11
+ Defined in: [to-capital-case.ts:17](https://github.com/isdk/util.js/blob/f467c507a8cfd31890519496ac9059c8ad3f8d03/src/to-capital-case.ts#L17)
12
+
13
+ Converts a string to capital case, where the first letter of each word is capitalized
14
+ and the rest are in lowercase. Words are separated by spaces, hyphens, or underscores.
15
+
16
+ ## Parameters
17
+
18
+ ### str
19
+
20
+ `string`
21
+
22
+ The input string to convert.
23
+
24
+ ## Returns
25
+
26
+ `string`
27
+
28
+ The converted string in capital case.
29
+
30
+ ## Example
31
+
32
+ ```typescript
33
+ toCapitalCase('hello world'); // Returns 'Hello World'
34
+ toCapitalCase('HELLO-WORLD'); // Returns 'Hello World'
35
+ toCapitalCase('hello_world'); // Returns 'Hello World'
36
+ toCapitalCase('hElLo_wOrLd-TeSt cAsE'); // Returns 'H El Lo W Or Ld Te St C As E'
37
+ toCapitalCase(''); // Returns ''
38
+ ```
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **toPascalCase**(`str`): `string`
10
10
 
11
- Defined in: [to-pascal-case.ts:16](https://github.com/isdk/util.js/blob/79fcdde5490ce675c34a8f772113e8a202beea65/src/to-pascal-case.ts#L16)
11
+ Defined in: [to-pascal-case.ts:16](https://github.com/isdk/util.js/blob/f467c507a8cfd31890519496ac9059c8ad3f8d03/src/to-pascal-case.ts#L16)
12
12
 
13
13
  Converts a string to PascalCase.
14
14
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **traverseFolder**(`directoryPath`, `fileHandler`): `Promise`\<`void`\>
10
10
 
11
- Defined in: [traverse-folder.ts:38](https://github.com/isdk/util.js/blob/79fcdde5490ce675c34a8f772113e8a202beea65/src/traverse-folder.ts#L38)
11
+ Defined in: [traverse-folder.ts:38](https://github.com/isdk/util.js/blob/f467c507a8cfd31890519496ac9059c8ad3f8d03/src/traverse-folder.ts#L38)
12
12
 
13
13
  Traverses a folder asynchronously and applies a handler to each file or directory.
14
14
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **traverseFolderSync**(`directoryPath`, `fileHandler`): `void`
10
10
 
11
- Defined in: [traverse-folder.ts:66](https://github.com/isdk/util.js/blob/79fcdde5490ce675c34a8f772113e8a202beea65/src/traverse-folder.ts#L66)
11
+ Defined in: [traverse-folder.ts:71](https://github.com/isdk/util.js/blob/f467c507a8cfd31890519496ac9059c8ad3f8d03/src/traverse-folder.ts#L71)
12
12
 
13
13
  Traverses a folder synchronously and applies a handler to each file or directory.
14
14
 
package/docs/globals.md CHANGED
@@ -35,6 +35,7 @@
35
35
  - [removeLeadingEmptyLines](functions/removeLeadingEmptyLines.md)
36
36
  - [stringifyYaml](functions/stringifyYaml.md)
37
37
  - [toCamelCase](functions/toCamelCase.md)
38
+ - [toCapitalCase](functions/toCapitalCase.md)
38
39
  - [toPascalCase](functions/toPascalCase.md)
39
40
  - [traverseFolder](functions/traverseFolder.md)
40
41
  - [traverseFolderSync](functions/traverseFolderSync.md)
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Interface: IncludeFiles
8
8
 
9
- Defined in: [include-files.ts:6](https://github.com/isdk/util.js/blob/79fcdde5490ce675c34a8f772113e8a202beea65/src/include-files.ts#L6)
9
+ Defined in: [include-files.ts:6](https://github.com/isdk/util.js/blob/f467c507a8cfd31890519496ac9059c8ad3f8d03/src/include-files.ts#L6)
10
10
 
11
11
  ## Properties
12
12
 
@@ -14,7 +14,7 @@ Defined in: [include-files.ts:6](https://github.com/isdk/util.js/blob/79fcdde549
14
14
 
15
15
  > `optional` **exclude**: `string`[]
16
16
 
17
- Defined in: [include-files.ts:8](https://github.com/isdk/util.js/blob/79fcdde5490ce675c34a8f772113e8a202beea65/src/include-files.ts#L8)
17
+ Defined in: [include-files.ts:8](https://github.com/isdk/util.js/blob/f467c507a8cfd31890519496ac9059c8ad3f8d03/src/include-files.ts#L8)
18
18
 
19
19
  ***
20
20
 
@@ -22,4 +22,4 @@ Defined in: [include-files.ts:8](https://github.com/isdk/util.js/blob/79fcdde549
22
22
 
23
23
  > `optional` **include**: `string`[]
24
24
 
25
- Defined in: [include-files.ts:7](https://github.com/isdk/util.js/blob/79fcdde5490ce675c34a8f772113e8a202beea65/src/include-files.ts#L7)
25
+ Defined in: [include-files.ts:7](https://github.com/isdk/util.js/blob/f467c507a8cfd31890519496ac9059c8ad3f8d03/src/include-files.ts#L7)
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Interface: LoadConfigFileOptions
8
8
 
9
- Defined in: [config-file.ts:20](https://github.com/isdk/util.js/blob/79fcdde5490ce675c34a8f772113e8a202beea65/src/config-file.ts#L20)
9
+ Defined in: [config-file.ts:20](https://github.com/isdk/util.js/blob/f467c507a8cfd31890519496ac9059c8ad3f8d03/src/config-file.ts#L20)
10
10
 
11
11
  ## Properties
12
12
 
@@ -14,7 +14,7 @@ Defined in: [config-file.ts:20](https://github.com/isdk/util.js/blob/79fcdde5490
14
14
 
15
15
  > `optional` **externalFile**: `string`
16
16
 
17
- Defined in: [config-file.ts:22](https://github.com/isdk/util.js/blob/79fcdde5490ce675c34a8f772113e8a202beea65/src/config-file.ts#L22)
17
+ Defined in: [config-file.ts:22](https://github.com/isdk/util.js/blob/f467c507a8cfd31890519496ac9059c8ad3f8d03/src/config-file.ts#L22)
18
18
 
19
19
  ***
20
20
 
@@ -22,4 +22,4 @@ Defined in: [config-file.ts:22](https://github.com/isdk/util.js/blob/79fcdde5490
22
22
 
23
23
  > `optional` **extLevel**: `number`
24
24
 
25
- Defined in: [config-file.ts:21](https://github.com/isdk/util.js/blob/79fcdde5490ce675c34a8f772113e8a202beea65/src/config-file.ts#L21)
25
+ Defined in: [config-file.ts:21](https://github.com/isdk/util.js/blob/f467c507a8cfd31890519496ac9059c8ad3f8d03/src/config-file.ts#L21)
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **StringifyFunc** = (`content`) => `string`
10
10
 
11
- Defined in: [config-file.ts:18](https://github.com/isdk/util.js/blob/79fcdde5490ce675c34a8f772113e8a202beea65/src/config-file.ts#L18)
11
+ Defined in: [config-file.ts:18](https://github.com/isdk/util.js/blob/f467c507a8cfd31890519496ac9059c8ad3f8d03/src/config-file.ts#L18)
12
12
 
13
13
  ## Parameters
14
14
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **TraverseFolderHandler** = (`filePath`, `entry`) => `boolean` \| `void` \| `Promise`\<`boolean` \| `void`\>
10
10
 
11
- Defined in: [traverse-folder.ts:11](https://github.com/isdk/util.js/blob/79fcdde5490ce675c34a8f772113e8a202beea65/src/traverse-folder.ts#L11)
11
+ Defined in: [traverse-folder.ts:11](https://github.com/isdk/util.js/blob/f467c507a8cfd31890519496ac9059c8ad3f8d03/src/traverse-folder.ts#L11)
12
12
 
13
13
  A handler function for asynchronous folder traversal.
14
14
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **TraverseFolderSyncHandler** = (`filePath`, `entry`) => `boolean` \| `void`
10
10
 
11
- Defined in: [traverse-folder.ts:18](https://github.com/isdk/util.js/blob/79fcdde5490ce675c34a8f772113e8a202beea65/src/traverse-folder.ts#L18)
11
+ Defined in: [traverse-folder.ts:18](https://github.com/isdk/util.js/blob/f467c507a8cfd31890519496ac9059c8ad3f8d03/src/traverse-folder.ts#L18)
12
12
 
13
13
  A handler function for synchronous folder traversal.
14
14
 
@@ -8,4 +8,4 @@
8
8
 
9
9
  > `const` **DefaultAllTextFiles**: `string`[]
10
10
 
11
- Defined in: [include-files.ts:1](https://github.com/isdk/util.js/blob/79fcdde5490ce675c34a8f772113e8a202beea65/src/include-files.ts#L1)
11
+ Defined in: [include-files.ts:1](https://github.com/isdk/util.js/blob/f467c507a8cfd31890519496ac9059c8ad3f8d03/src/include-files.ts#L1)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@isdk/util",
3
3
  "description": "a set of utility functions",
4
- "version": "0.1.2",
4
+ "version": "0.1.4",
5
5
  "author": "Riceball LEE @snowyu",
6
6
  "bugs": "https://github.com/isdk/util.js/issues",
7
7
  "dependencies": {