@isdk/util 0.1.2 → 0.1.3
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 +19 -1
- package/dist/index.d.ts +19 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/docs/classes/ConfigFile.md +5 -5
- package/docs/functions/getMultiLevelExtname.md +1 -1
- package/docs/functions/glob.md +1 -1
- package/docs/functions/isStringIn.md +1 -1
- package/docs/functions/normalizeIncludeFiles.md +1 -1
- package/docs/functions/parseFrontMatter.md +1 -1
- package/docs/functions/parseYaml.md +1 -1
- package/docs/functions/registerYamlTag.md +1 -1
- package/docs/functions/removeLeadingEmptyLines.md +1 -1
- package/docs/functions/stringifyYaml.md +1 -1
- package/docs/functions/toCamelCase.md +1 -1
- package/docs/functions/toCapitalCase.md +38 -0
- package/docs/functions/toPascalCase.md +1 -1
- package/docs/functions/traverseFolder.md +1 -1
- package/docs/functions/traverseFolderSync.md +1 -1
- package/docs/globals.md +1 -0
- package/docs/interfaces/IncludeFiles.md +3 -3
- package/docs/interfaces/LoadConfigFileOptions.md +3 -3
- package/docs/type-aliases/StringifyFunc.md +1 -1
- package/docs/type-aliases/TraverseFolderHandler.md +1 -1
- package/docs/type-aliases/TraverseFolderSyncHandler.md +1 -1
- package/docs/variables/DefaultAllTextFiles.md +1 -1
- package/package.json +1 -1
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
|
-
|
|
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
|
-
|
|
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:()=>
|
|
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:()=>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 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 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 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 A(e,t,r){return r&&(e=w.default.relative(r,e)),(0,O.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,recursive:!0});for(const n of r){const r=z.default.join(e,n.name);if(!0===await t(r,n))break}}function _(e,t){const r=(0,$.readdirSync)(e,{withFileTypes:!0,recursive:!0});for(const n of r){if(!0===t(z.default.join(e,n.name),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
|
|
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 s from"path";function f(t,n=1){let r="";for(;n--;){const n=s.extname(t);if(!n)break;r=n+r,t=s.basename(t,n)}return r}import{parse as c,stringify as u}from"yaml";var a=[];function l(t){Array.isArray(t)||(t=[t]);for(const n of t){-1===a.indexOf(n)&&a.push(n)}}function m(t,n){if(n)if(n.customTags){if(Array.isArray(n.customTags))n.customTags=a.concat(n.customTags);else if("function"==typeof n.customTags){const t=n.customTags;n.customTags=n=>t(a.concat(n))}}else n.customTags=a;else n={customTags:a};return c(t,n)}function p(t,n){if(n)if(n.customTags){if(Array.isArray(n.customTags))n.customTags=a.concat(n.customTags);else if("function"==typeof n.customTags){const t=n.customTags;n.customTags=n=>t(a.concat(n))}}else n.customTags=a;else n={customTags:a};return u(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:s}={}){"."===n[0]&&o++;const c=f(n,o);c&&c.split(".").length>1&&(n=n.slice(0,-c.length));let u=i.loadSync(n);if(!u&&s){if(!e.isAbsolute(s)){const t=e.dirname(n);s=e.join(t,s)}if(t(s)){const t=h(r(s,"utf8")).data;Object.keys(t).length&&(u=t)}}return u}(n,o)}static save(r,i,s){return function(r,i,{extLevel:s=1}={}){"."===r[0]&&s++;let c=f(r,s);(!c||c.split(".").length<=1)&&(r+=".yaml",c=".yaml");const u=g.stringifys[c];if(!u)throw new Error(`${r} unsupported mime type: ${c}`);i=u(i);const a=e.dirname(r);t(a)||n(a,{recursive:!0});return o(r,i,{encoding:"utf8"}),r}(r,i,s)}};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,n,r){return r&&(t=v.relative(r,t)),x(t,n)}function b(t,n){return"string"==typeof n&&(n=[n]),-1!==n.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,n=w){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,recursive:!0});for(const o of r){const r=$.join(t,o.name);if(!0===await n(r,o))break}}function z(t,n){const r=A(t,{withFileTypes:!0,recursive:!0});for(const o of r){if(!0===n($.join(t,o.name),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,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,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/
|
|
9
|
+
Defined in: [config-file.ts:46](https://github.com/isdk/util.js/blob/d56ec17a58f2c8d32fa62a973286199a24a5c2c7/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/
|
|
48
|
+
Defined in: [config-file.ts:50](https://github.com/isdk/util.js/blob/d56ec17a58f2c8d32fa62a973286199a24a5c2c7/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/
|
|
58
|
+
Defined in: [config-file.ts:85](https://github.com/isdk/util.js/blob/d56ec17a58f2c8d32fa62a973286199a24a5c2c7/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/
|
|
95
|
+
Defined in: [config-file.ts:64](https://github.com/isdk/util.js/blob/d56ec17a58f2c8d32fa62a973286199a24a5c2c7/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/
|
|
135
|
+
Defined in: [config-file.ts:102](https://github.com/isdk/util.js/blob/d56ec17a58f2c8d32fa62a973286199a24a5c2c7/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/
|
|
11
|
+
Defined in: [get-multi-level-extname.ts:9](https://github.com/isdk/util.js/blob/d56ec17a58f2c8d32fa62a973286199a24a5c2c7/src/get-multi-level-extname.ts#L9)
|
|
12
12
|
|
|
13
13
|
Retrieves multi-level file extension
|
|
14
14
|
|
package/docs/functions/glob.md
CHANGED
|
@@ -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/
|
|
11
|
+
Defined in: [glob.ts:29](https://github.com/isdk/util.js/blob/d56ec17a58f2c8d32fa62a973286199a24a5c2c7/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/
|
|
11
|
+
Defined in: [is-string-in.ts:17](https://github.com/isdk/util.js/blob/d56ec17a58f2c8d32fa62a973286199a24a5c2c7/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/
|
|
11
|
+
Defined in: [include-files.ts:34](https://github.com/isdk/util.js/blob/d56ec17a58f2c8d32fa62a973286199a24a5c2c7/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/
|
|
11
|
+
Defined in: [front-matter.ts:6](https://github.com/isdk/util.js/blob/d56ec17a58f2c8d32fa62a973286199a24a5c2c7/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/
|
|
11
|
+
Defined in: [yaml.ts:51](https://github.com/isdk/util.js/blob/d56ec17a58f2c8d32fa62a973286199a24a5c2c7/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/
|
|
11
|
+
Defined in: [yaml.ts:23](https://github.com/isdk/util.js/blob/d56ec17a58f2c8d32fa62a973286199a24a5c2c7/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/
|
|
11
|
+
Defined in: [remove-leading-empty-lines.ts:16](https://github.com/isdk/util.js/blob/d56ec17a58f2c8d32fa62a973286199a24a5c2c7/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/
|
|
11
|
+
Defined in: [yaml.ts:85](https://github.com/isdk/util.js/blob/d56ec17a58f2c8d32fa62a973286199a24a5c2c7/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/
|
|
11
|
+
Defined in: [to-camel-case.ts:17](https://github.com/isdk/util.js/blob/d56ec17a58f2c8d32fa62a973286199a24a5c2c7/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/d56ec17a58f2c8d32fa62a973286199a24a5c2c7/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/
|
|
11
|
+
Defined in: [to-pascal-case.ts:16](https://github.com/isdk/util.js/blob/d56ec17a58f2c8d32fa62a973286199a24a5c2c7/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/
|
|
11
|
+
Defined in: [traverse-folder.ts:38](https://github.com/isdk/util.js/blob/d56ec17a58f2c8d32fa62a973286199a24a5c2c7/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/
|
|
11
|
+
Defined in: [traverse-folder.ts:66](https://github.com/isdk/util.js/blob/d56ec17a58f2c8d32fa62a973286199a24a5c2c7/src/traverse-folder.ts#L66)
|
|
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/
|
|
9
|
+
Defined in: [include-files.ts:6](https://github.com/isdk/util.js/blob/d56ec17a58f2c8d32fa62a973286199a24a5c2c7/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/
|
|
17
|
+
Defined in: [include-files.ts:8](https://github.com/isdk/util.js/blob/d56ec17a58f2c8d32fa62a973286199a24a5c2c7/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/
|
|
25
|
+
Defined in: [include-files.ts:7](https://github.com/isdk/util.js/blob/d56ec17a58f2c8d32fa62a973286199a24a5c2c7/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/
|
|
9
|
+
Defined in: [config-file.ts:20](https://github.com/isdk/util.js/blob/d56ec17a58f2c8d32fa62a973286199a24a5c2c7/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/
|
|
17
|
+
Defined in: [config-file.ts:22](https://github.com/isdk/util.js/blob/d56ec17a58f2c8d32fa62a973286199a24a5c2c7/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/
|
|
25
|
+
Defined in: [config-file.ts:21](https://github.com/isdk/util.js/blob/d56ec17a58f2c8d32fa62a973286199a24a5c2c7/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/
|
|
11
|
+
Defined in: [config-file.ts:18](https://github.com/isdk/util.js/blob/d56ec17a58f2c8d32fa62a973286199a24a5c2c7/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/
|
|
11
|
+
Defined in: [traverse-folder.ts:11](https://github.com/isdk/util.js/blob/d56ec17a58f2c8d32fa62a973286199a24a5c2c7/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/
|
|
11
|
+
Defined in: [traverse-folder.ts:18](https://github.com/isdk/util.js/blob/d56ec17a58f2c8d32fa62a973286199a24a5c2c7/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/
|
|
11
|
+
Defined in: [include-files.ts:1](https://github.com/isdk/util.js/blob/d56ec17a58f2c8d32fa62a973286199a24a5c2c7/src/include-files.ts#L1)
|