@isdk/util 0.2.0 → 0.3.0
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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/docs/classes/ConfigFile.md +5 -5
- package/docs/functions/extNameLevel.md +1 -1
- package/docs/functions/filenameReservedRegex.md +1 -1
- package/docs/functions/getMultiLevelExtname.md +1 -1
- package/docs/functions/glob.md +1 -1
- package/docs/functions/isStringIn.md +1 -1
- package/docs/functions/isValidFilename.md +1 -1
- package/docs/functions/isValidFilepath.md +1 -1
- package/docs/functions/normalizeIncludeFiles.md +2 -2
- package/docs/functions/parseFrontMatter.md +1 -1
- package/docs/functions/parseYaml.md +1 -1
- package/docs/functions/reControlCharsRegex.md +1 -1
- package/docs/functions/registerYamlTag.md +1 -1
- package/docs/functions/removeLeadingEmptyLines.md +1 -1
- package/docs/functions/sanitizeFilename.md +1 -1
- package/docs/functions/sanitizeFilepath.md +1 -1
- package/docs/functions/stringifyYaml.md +1 -1
- package/docs/functions/toCamelCase.md +1 -1
- package/docs/functions/toCapitalCase.md +1 -1
- package/docs/functions/toPascalCase.md +1 -1
- package/docs/functions/traverseFolder.md +1 -1
- package/docs/functions/traverseFolderSync.md +1 -1
- package/docs/interfaces/IncludeFiles.md +3 -3
- package/docs/interfaces/LoadConfigFileOptions.md +3 -3
- package/docs/interfaces/SanitizeFilenameOptions.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/docs/variables/FilenameReservedRegex.md +1 -1
- package/docs/variables/WindowsReservedNameRegex.md +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -148,7 +148,7 @@ interface IncludeFiles {
|
|
|
148
148
|
* // Output: ['*.ts', '*.js', '!node_modules/**']
|
|
149
149
|
* ```
|
|
150
150
|
*/
|
|
151
|
-
declare function normalizeIncludeFiles(files?: string[] | IncludeFiles, defaultFiles?:
|
|
151
|
+
declare function normalizeIncludeFiles(files?: string[] | IncludeFiles, defaultFiles?: never[]): string[];
|
|
152
152
|
|
|
153
153
|
declare function parseFrontMatter(value: string, delimiter?: string): {
|
|
154
154
|
data: any;
|
package/dist/index.d.ts
CHANGED
|
@@ -148,7 +148,7 @@ interface IncludeFiles {
|
|
|
148
148
|
* // Output: ['*.ts', '*.js', '!node_modules/**']
|
|
149
149
|
* ```
|
|
150
150
|
*/
|
|
151
|
-
declare function normalizeIncludeFiles(files?: string[] | IncludeFiles, defaultFiles?:
|
|
151
|
+
declare function normalizeIncludeFiles(files?: string[] | IncludeFiles, defaultFiles?: never[]): string[];
|
|
152
152
|
|
|
153
153
|
declare function parseFrontMatter(value: string, delimiter?: string): {
|
|
154
154
|
data: any;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,a=(e,t,o,a)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let u of i(t))s.call(e,u)||u===o||n(e,u,{get:()=>t[u],enumerable:!(a=r(t,u))||a.enumerable});return e},u=(e,r,i)=>(i=null!=e?t(o(e)):{},a(!r&&e&&e.__esModule?i:n(i,"default",{value:e,enumerable:!0}),e)),c={};((e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})})(c,{ConfigFile:()=>q,DefaultAllTextFiles:()=>O,FilenameReservedRegex:()=>B,WindowsReservedNameRegex:()=>D,extNameLevel:()=>U,filenameReservedRegex:()=>W,getMultiLevelExtname:()=>g,glob:()=>R,isStringIn:()=>E,isValidFilename:()=>G,isValidFilepath:()=>H,normalizeIncludeFiles:()=>C,parseFrontMatter:()=>j,parseYaml:()=>h,reControlCharsRegex:()=>Z,registerYamlTag:()=>v,removeLeadingEmptyLines:()=>b,sanitizeFilename:()=>K,sanitizeFilepath:()=>Q,stringifyYaml:()=>F,toCamelCase:()=>N,toCapitalCase:()=>M,toPascalCase:()=>T,traverseFolder:()=>L,traverseFolderSync:()=>S}),module.exports=(e=c,a(n({},"__esModule",{value:!0}),e));var l=require("fs"),f=u(require("path")),m=require("load-config-file"),p=u(require("path"));function g(e,t=1){let n="";for(;t--;){const t=p.default.extname(e);if(!t)break;n=t+n,e=p.default.basename(e,t)}return n}var y=require("yaml"),d=[];function v(e){Array.isArray(e)||(e=[e]);for(const t of e){-1===d.indexOf(t)&&d.push(t)}}function h(e,t){if(t)if(t.customTags){if(Array.isArray(t.customTags))t.customTags=d.concat(t.customTags);else if("function"==typeof t.customTags){const e=t.customTags;t.customTags=t=>e(d.concat(t))}}else t.customTags=d;else t={customTags:d};return(0,y.parse)(e,t)}function F(e,t){if(t)if(t.customTags){if(Array.isArray(t.customTags))t.customTags=d.concat(t.customTags);else if("function"==typeof t.customTags){const e=t.customTags;t.customTags=t=>e(d.concat(t))}}else t.customTags=d;else t={customTags:d};return(0,y.stringify)(e,t)}function b(e){const t=/^\s*(#[^\r\n]*)?[\r\n]+/;let n;for(;null!==(n=t.exec(e))&&((e=e.substring(n[0].length)).startsWith("\n")||e.startsWith("\r")||e.trimStart().startsWith("#")););return e}var x="---";function j(e,t=x){const n=t.length,r=b(e);if(r.startsWith(t)&&("\n"===r[t.length]||"\r"===r[t.length])){let e=r.indexOf("\n"+t,n);if(-1!==e){const i=r.slice(n,e);for(e+=t.length+1;"\n"===r[e]||"\r"===r[e];)e++;const o=r.slice(e);return{data:h(i)||{},content:o}}}return{data:{},content:e}}var q=class{static register(e,t,n){m.Config.register(e,t),"string"==typeof e&&(e=[e]);for(const t of e)this.stringifys[t]=n}static loadSync(e,t){return function(e,{extLevel:t=1,externalFile:n}={}){"."===e[0]&&t++;const r=g(e,t);r&&r.split(".").length>1&&(e=e.slice(0,-r.length));let i=m.Config.loadSync(e);if(!i&&n){if(!f.default.isAbsolute(n)){const t=f.default.dirname(e);n=f.default.join(t,n)}if((0,l.existsSync)(n)){const e=j((0,l.readFileSync)(n,"utf8")).data;Object.keys(e).length&&(i=e)}}return i}(e,t)}static saveSync(e,t,n){return function(e,t,{extLevel:n=1}={}){"."===e[0]&&n++;let r=g(e,n);(!r||r.split(".").length<=1)&&(e+=".yaml",r=".yaml");const i=q.stringifys[r];if(!i)throw new Error(`${e} unsupported mime type: ${r}`);t=i(t);const o=f.default.dirname(e);(0,l.existsSync)(o)||(0,l.mkdirSync)(o,{recursive:!0});return(0,l.writeFileSync)(e,t,{encoding:"utf8"}),e}(e,t,n)}};q.stringifys={},q.register([".yml",".yaml"],h,F),q.register([".json"],(function(e){return JSON.parse(e)}),(e=>JSON.stringify(e,null,2)));var w=require("@isdk/glob"),$=u(require("path"));function R(e,t,n){return n&&(e=$.default.relative(n,e)),(0,w.globMatch)(e,t)}function E(e,t){return"string"==typeof t&&(t=[t]),-1!==t.indexOf(e)}var O=["**/*.((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 C(e,t=
|
|
1
|
+
"use strict";var e,t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,a=(e,t,o,a)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let u of i(t))s.call(e,u)||u===o||n(e,u,{get:()=>t[u],enumerable:!(a=r(t,u))||a.enumerable});return e},u=(e,r,i)=>(i=null!=e?t(o(e)):{},a(!r&&e&&e.__esModule?i:n(i,"default",{value:e,enumerable:!0}),e)),c={};((e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})})(c,{ConfigFile:()=>q,DefaultAllTextFiles:()=>O,FilenameReservedRegex:()=>B,WindowsReservedNameRegex:()=>D,extNameLevel:()=>U,filenameReservedRegex:()=>W,getMultiLevelExtname:()=>g,glob:()=>R,isStringIn:()=>E,isValidFilename:()=>G,isValidFilepath:()=>H,normalizeIncludeFiles:()=>C,parseFrontMatter:()=>j,parseYaml:()=>h,reControlCharsRegex:()=>Z,registerYamlTag:()=>v,removeLeadingEmptyLines:()=>b,sanitizeFilename:()=>K,sanitizeFilepath:()=>Q,stringifyYaml:()=>F,toCamelCase:()=>N,toCapitalCase:()=>M,toPascalCase:()=>T,traverseFolder:()=>L,traverseFolderSync:()=>S}),module.exports=(e=c,a(n({},"__esModule",{value:!0}),e));var l=require("fs"),f=u(require("path")),m=require("load-config-file"),p=u(require("path"));function g(e,t=1){let n="";for(;t--;){const t=p.default.extname(e);if(!t)break;n=t+n,e=p.default.basename(e,t)}return n}var y=require("yaml"),d=[];function v(e){Array.isArray(e)||(e=[e]);for(const t of e){-1===d.indexOf(t)&&d.push(t)}}function h(e,t){if(t)if(t.customTags){if(Array.isArray(t.customTags))t.customTags=d.concat(t.customTags);else if("function"==typeof t.customTags){const e=t.customTags;t.customTags=t=>e(d.concat(t))}}else t.customTags=d;else t={customTags:d};return(0,y.parse)(e,t)}function F(e,t){if(t)if(t.customTags){if(Array.isArray(t.customTags))t.customTags=d.concat(t.customTags);else if("function"==typeof t.customTags){const e=t.customTags;t.customTags=t=>e(d.concat(t))}}else t.customTags=d;else t={customTags:d};return(0,y.stringify)(e,t)}function b(e){const t=/^\s*(#[^\r\n]*)?[\r\n]+/;let n;for(;null!==(n=t.exec(e))&&((e=e.substring(n[0].length)).startsWith("\n")||e.startsWith("\r")||e.trimStart().startsWith("#")););return e}var x="---";function j(e,t=x){const n=t.length,r=b(e);if(r.startsWith(t)&&("\n"===r[t.length]||"\r"===r[t.length])){let e=r.indexOf("\n"+t,n);if(-1!==e){const i=r.slice(n,e);for(e+=t.length+1;"\n"===r[e]||"\r"===r[e];)e++;const o=r.slice(e);return{data:h(i)||{},content:o}}}return{data:{},content:e}}var q=class{static register(e,t,n){m.Config.register(e,t),"string"==typeof e&&(e=[e]);for(const t of e)this.stringifys[t]=n}static loadSync(e,t){return function(e,{extLevel:t=1,externalFile:n}={}){"."===e[0]&&t++;const r=g(e,t);r&&r.split(".").length>1&&(e=e.slice(0,-r.length));let i=m.Config.loadSync(e);if(!i&&n){if(!f.default.isAbsolute(n)){const t=f.default.dirname(e);n=f.default.join(t,n)}if((0,l.existsSync)(n)){const e=j((0,l.readFileSync)(n,"utf8")).data;Object.keys(e).length&&(i=e)}}return i}(e,t)}static saveSync(e,t,n){return function(e,t,{extLevel:n=1}={}){"."===e[0]&&n++;let r=g(e,n);(!r||r.split(".").length<=1)&&(e+=".yaml",r=".yaml");const i=q.stringifys[r];if(!i)throw new Error(`${e} unsupported mime type: ${r}`);t=i(t);const o=f.default.dirname(e);(0,l.existsSync)(o)||(0,l.mkdirSync)(o,{recursive:!0});return(0,l.writeFileSync)(e,t,{encoding:"utf8"}),e}(e,t,n)}};q.stringifys={},q.register([".yml",".yaml"],h,F),q.register([".json"],(function(e){return JSON.parse(e)}),(e=>JSON.stringify(e,null,2)));var w=require("@isdk/glob"),$=u(require("path"));function R(e,t,n){return n&&(e=$.default.relative(n,e)),(0,w.globMatch)(e,t)}function E(e,t){return"string"==typeof t&&(t=[t]),-1!==t.indexOf(e)}var O=["**/*.((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 C(e,t=[]){if(e)if(Array.isArray(e))e=[...e];else{const n=e.include||[],r=e.exclude||[];0===n.length&&n.push(...t),e=[...n];for(const t of r)e.push(`!${t}`)}else e=[...t];return 0===e.length&&e.push(...t),e}var z=require("fs/promises"),A=require("fs"),k=u(require("path"));async function L(e,t){const n=await(0,z.readdir)(e,{withFileTypes:!0});for(const r of n){const n=k.default.join(e,r.name);try{if(r.isDirectory()){await t(n,r)||await L(n,t)}else{if(!0===await t(n,r))break}}catch(e){console.error(`Error processing file: ${n}`),console.error(e)}}}function S(e,t){const n=(0,A.readdirSync)(e,{withFileTypes:!0});for(const r of n){const n=k.default.join(e,r.name);try{if(r.isDirectory()){t(n,r)||L(n,t)}else{if(!0===t(n,r))break}}catch(e){console.error(`Error processing file: ${n}`),console.error(e)}}}function T(e){if(!e)return"";return e.replace(/[-_ ]+/g," ").split(" ").filter(Boolean).map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join("")}function N(e){return(e=T(e)).charAt(0).toLowerCase()+e.slice(1)}function M(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(" ")}var _=u(require("path")),Y=require("@isdk/common-error"),B=/[<>:"/\\|?*\u0000-\u001F]/,D=/^(con|prn|aux|nul|com\d|lpt\d)$/i,I=100,J=/^\.+(\\|\/)|^\.+$/,V=/\.+$/,P=/[\u0000-\u001F\u0080-\u009F\u200E\u200F\u202A-\u202E\u2066-\u2069]/;function W(){return new RegExp(B.source,"g")}function Z(){return new RegExp(P.source,"g")}function G(e){return e&&!(B.test(e)||Z().test(e)||J.test(e)||V.test(e))}function H(e){const t=e.split(_.default.sep);return("/"===e[0]||t[0]&&_.default.dirname(t[0])===t[0])&&t.shift(),t.every(G)}function K(e,t={}){const n=t.replacement||"!";if((B.test(n)||P.test(n))&&(0,Y.throwError)("Replacement string cannot contain reserved filename characters","sanitizeFilename",Y.ErrorCode.InvalidArgument),n.length>0){const t=/([<>:"/\\|?*\u0000-\u001F]){2,}/;e=e.replace(t,"$1")}if(e=(e=(e=(e=(e=e.normalize("NFD")).replace(J,n)).replace(W(),n)).replace(Z(),n)).replace(V,""),n.length>0){"."===e[0]||"."!==e[0]||(e=n+e),"."===e[e.length-1]&&(e+=n)}e=D.test(e)?e+n:e;const r="number"==typeof t.maxLength?t.maxLength:I;if(e.length>r){const t=e.lastIndexOf(".");if(-1===t)e=e.slice(0,r);else{const n=e.slice(0,t),i=e.slice(t);e=n.slice(0,Math.max(1,r-i.length))+i}}return e}function Q(e,t={}){const n=e.split(_.default.sep);let r;("/"===e[0]||n[0]&&_.default.dirname(n[0])===n[0])&&(r=n.shift());const i=n.map((e=>K(e,t)));return void 0!==r&&i.unshift(r),i.join(_.default.sep)}function U(e){return e.split(".").length-1}
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as t,mkdirSync as n,readFileSync as o,writeFileSync as r}from"fs";import e from"path";import{Config as i}from"load-config-file";import s from"path";function f(t,n=1){let o="";for(;n--;){const n=s.extname(t);if(!n)break;o=n+o,t=s.basename(t,n)}return o}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 o;for(;null!==(o=n.exec(t))&&((t=t.substring(o[0].length)).startsWith("\n")||t.startsWith("\r")||t.trimStart().startsWith("#")););return t}function g(t,n="---"){const o=n.length,r=y(t);if(r.startsWith(n)&&("\n"===r[n.length]||"\r"===r[n.length])){let t=r.indexOf("\n"+n,o);if(-1!==t){const e=r.slice(o,t);for(t+=n.length+1;"\n"===r[t]||"\r"===r[t];)t++;const i=r.slice(t);return{data:m(e)||{},content:i}}}return{data:{},content:t}}var h=class{static register(t,n,o){i.register(t,n),"string"==typeof t&&(t=[t]);for(const n of t)this.stringifys[n]=o}static loadSync(n,r){return function(n,{extLevel:r=1,externalFile:s}={}){"."===n[0]&&r++;const c=f(n,r);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=g(o(s,"utf8")).data;Object.keys(t).length&&(u=t)}}return u}(n,r)}static saveSync(o,i,s){return function(o,i,{extLevel:s=1}={}){"."===o[0]&&s++;let c=f(o,s);(!c||c.split(".").length<=1)&&(o+=".yaml",c=".yaml");const u=h.stringifys[c];if(!u)throw new Error(`${o} unsupported mime type: ${c}`);i=u(i);const a=e.dirname(o);t(a)||n(a,{recursive:!0});return r(o,i,{encoding:"utf8"}),o}(o,i,s)}};h.stringifys={},h.register([".yml",".yaml"],m,p),h.register([".json"],(function(t){return JSON.parse(t)}),(t=>JSON.stringify(t,null,2)));import{globMatch as d}from"@isdk/glob";import x from"path";function v(t,n,o){return o&&(t=x.relative(o,t)),d(t,n)}function w(t,n){return"string"==typeof n&&(n=[n]),-1!==n.indexOf(t)}var $=["**/*.((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 F(t,n
|
|
1
|
+
import{existsSync as t,mkdirSync as n,readFileSync as o,writeFileSync as r}from"fs";import e from"path";import{Config as i}from"load-config-file";import s from"path";function f(t,n=1){let o="";for(;n--;){const n=s.extname(t);if(!n)break;o=n+o,t=s.basename(t,n)}return o}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 o;for(;null!==(o=n.exec(t))&&((t=t.substring(o[0].length)).startsWith("\n")||t.startsWith("\r")||t.trimStart().startsWith("#")););return t}function g(t,n="---"){const o=n.length,r=y(t);if(r.startsWith(n)&&("\n"===r[n.length]||"\r"===r[n.length])){let t=r.indexOf("\n"+n,o);if(-1!==t){const e=r.slice(o,t);for(t+=n.length+1;"\n"===r[t]||"\r"===r[t];)t++;const i=r.slice(t);return{data:m(e)||{},content:i}}}return{data:{},content:t}}var h=class{static register(t,n,o){i.register(t,n),"string"==typeof t&&(t=[t]);for(const n of t)this.stringifys[n]=o}static loadSync(n,r){return function(n,{extLevel:r=1,externalFile:s}={}){"."===n[0]&&r++;const c=f(n,r);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=g(o(s,"utf8")).data;Object.keys(t).length&&(u=t)}}return u}(n,r)}static saveSync(o,i,s){return function(o,i,{extLevel:s=1}={}){"."===o[0]&&s++;let c=f(o,s);(!c||c.split(".").length<=1)&&(o+=".yaml",c=".yaml");const u=h.stringifys[c];if(!u)throw new Error(`${o} unsupported mime type: ${c}`);i=u(i);const a=e.dirname(o);t(a)||n(a,{recursive:!0});return r(o,i,{encoding:"utf8"}),o}(o,i,s)}};h.stringifys={},h.register([".yml",".yaml"],m,p),h.register([".json"],(function(t){return JSON.parse(t)}),(t=>JSON.stringify(t,null,2)));import{globMatch as d}from"@isdk/glob";import x from"path";function v(t,n,o){return o&&(t=x.relative(o,t)),d(t,n)}function w(t,n){return"string"==typeof n&&(n=[n]),-1!==n.indexOf(t)}var $=["**/*.((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 F(t,n=[]){if(t)if(Array.isArray(t))t=[...t];else{const o=t.include||[],r=t.exclude||[];0===o.length&&o.push(...n),t=[...o];for(const n of r)t.push(`!${n}`)}else t=[...n];return 0===t.length&&t.push(...n),t}import{readdir as b}from"fs/promises";import{readdirSync as E}from"fs";import j from"path";async function k(t,n){const o=await b(t,{withFileTypes:!0});for(const r of o){const o=j.join(t,r.name);try{if(r.isDirectory()){await n(o,r)||await k(o,n)}else{if(!0===await n(o,r))break}}catch(t){console.error(`Error processing file: ${o}`),console.error(t)}}}function A(t,n){const o=E(t,{withFileTypes:!0});for(const r of o){const o=j.join(t,r.name);try{if(r.isDirectory()){n(o,r)||k(o,n)}else{if(!0===n(o,r))break}}catch(t){console.error(`Error processing file: ${o}`),console.error(t)}}}function z(t){if(!t)return"";return t.replace(/[-_ ]+/g," ").split(" ").filter(Boolean).map((t=>t.charAt(0).toUpperCase()+t.slice(1))).join("")}function S(t){return(t=z(t)).charAt(0).toLowerCase()+t.slice(1)}function T(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(" ")}import N from"path";import{ErrorCode as O,throwError as R}from"@isdk/common-error";var B=/[<>:"/\\|?*\u0000-\u001F]/,J=/^(con|prn|aux|nul|com\d|lpt\d)$/i,L=/^\.+(\\|\/)|^\.+$/,_=/\.+$/,C=/[\u0000-\u001F\u0080-\u009F\u200E\u200F\u202A-\u202E\u2066-\u2069]/;function D(){return new RegExp(B.source,"g")}function M(){return new RegExp(C.source,"g")}function Z(t){return t&&!(B.test(t)||M().test(t)||L.test(t)||_.test(t))}function q(t){const n=t.split(N.sep);return("/"===t[0]||n[0]&&N.dirname(n[0])===n[0])&&n.shift(),n.every(Z)}function G(t,n={}){const o=n.replacement||"!";if((B.test(o)||C.test(o))&&R("Replacement string cannot contain reserved filename characters","sanitizeFilename",O.InvalidArgument),o.length>0){const n=/([<>:"/\\|?*\u0000-\u001F]){2,}/;t=t.replace(n,"$1")}if(t=(t=(t=(t=(t=t.normalize("NFD")).replace(L,o)).replace(D(),o)).replace(M(),o)).replace(_,""),o.length>0){"."===t[0]||"."!==t[0]||(t=o+t),"."===t[t.length-1]&&(t+=o)}t=J.test(t)?t+o:t;const r="number"==typeof n.maxLength?n.maxLength:100;if(t.length>r){const n=t.lastIndexOf(".");if(-1===n)t=t.slice(0,r);else{const o=t.slice(0,n),e=t.slice(n);t=o.slice(0,Math.max(1,r-e.length))+e}}return t}function H(t,n={}){const o=t.split(N.sep);let r;("/"===t[0]||o[0]&&N.dirname(o[0])===o[0])&&(r=o.shift());const e=o.map((t=>G(t,n)));return void 0!==r&&e.unshift(r),e.join(N.sep)}function I(t){return t.split(".").length-1}export{h as ConfigFile,$ as DefaultAllTextFiles,B as FilenameReservedRegex,J as WindowsReservedNameRegex,I as extNameLevel,D as filenameReservedRegex,f as getMultiLevelExtname,v as glob,w as isStringIn,Z as isValidFilename,q as isValidFilepath,F as normalizeIncludeFiles,g as parseFrontMatter,m as parseYaml,M as reControlCharsRegex,l as registerYamlTag,y as removeLeadingEmptyLines,G as sanitizeFilename,H as sanitizeFilepath,p as stringifyYaml,S as toCamelCase,T as toCapitalCase,z as toPascalCase,k as traverseFolder,A 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/4a17f40c6487cc8186e888c58b4e6268f4dcb357/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/4a17f40c6487cc8186e888c58b4e6268f4dcb357/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` **loadSync**(`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/4a17f40c6487cc8186e888c58b4e6268f4dcb357/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/4a17f40c6487cc8186e888c58b4e6268f4dcb357/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` **saveSync**(`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/4a17f40c6487cc8186e888c58b4e6268f4dcb357/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
|
> **extNameLevel**(`extName`): `number`
|
|
10
10
|
|
|
11
|
-
Defined in: [filename.ts:189](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [filename.ts:189](https://github.com/isdk/util.js/blob/4a17f40c6487cc8186e888c58b4e6268f4dcb357/src/filename.ts#L189)
|
|
12
12
|
|
|
13
13
|
Calculates the level of an extension name.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **filenameReservedRegex**(): `RegExp`
|
|
10
10
|
|
|
11
|
-
Defined in: [filename.ts:42](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [filename.ts:42](https://github.com/isdk/util.js/blob/4a17f40c6487cc8186e888c58b4e6268f4dcb357/src/filename.ts#L42)
|
|
12
12
|
|
|
13
13
|
Returns a new regular expression instance for reserved filename characters with the 'g' flag.
|
|
14
14
|
use this to reset the with global option
|
|
@@ -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/4a17f40c6487cc8186e888c58b4e6268f4dcb357/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/4a17f40c6487cc8186e888c58b4e6268f4dcb357/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/4a17f40c6487cc8186e888c58b4e6268f4dcb357/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
|
> **isValidFilename**(`filename`): `boolean` \| `""`
|
|
10
10
|
|
|
11
|
-
Defined in: [filename.ts:63](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [filename.ts:63](https://github.com/isdk/util.js/blob/4a17f40c6487cc8186e888c58b4e6268f4dcb357/src/filename.ts#L63)
|
|
12
12
|
|
|
13
13
|
Validates if a given string is a valid filename.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **isValidFilepath**(`filepath`): `boolean`
|
|
10
10
|
|
|
11
|
-
Defined in: [filename.ts:72](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [filename.ts:72](https://github.com/isdk/util.js/blob/4a17f40c6487cc8186e888c58b4e6268f4dcb357/src/filename.ts#L72)
|
|
12
12
|
|
|
13
13
|
Validates whether the given filepath is valid.
|
|
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/4a17f40c6487cc8186e888c58b4e6268f4dcb357/src/include-files.ts#L34)
|
|
12
12
|
|
|
13
13
|
Normalizes a list of file patterns for glob matching.
|
|
14
14
|
|
|
@@ -26,7 +26,7 @@ Either an array of file patterns or an object with `include` and `exclude` prope
|
|
|
26
26
|
|
|
27
27
|
### defaultFiles?
|
|
28
28
|
|
|
29
|
-
`
|
|
29
|
+
`never`[] = `[]`
|
|
30
30
|
|
|
31
31
|
An optional array of default file patterns to use if no include patterns are specified.
|
|
32
32
|
Defaults to `DefaultAllTextFiles`.
|
|
@@ -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/4a17f40c6487cc8186e888c58b4e6268f4dcb357/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/4a17f40c6487cc8186e888c58b4e6268f4dcb357/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
|
> **reControlCharsRegex**(): `RegExp`
|
|
10
10
|
|
|
11
|
-
Defined in: [filename.ts:50](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [filename.ts:50](https://github.com/isdk/util.js/blob/4a17f40c6487cc8186e888c58b4e6268f4dcb357/src/filename.ts#L50)
|
|
12
12
|
|
|
13
13
|
Returns a new regular expression instance for control characters in a filename with the 'g' flag.
|
|
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/4a17f40c6487cc8186e888c58b4e6268f4dcb357/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/4a17f40c6487cc8186e888c58b4e6268f4dcb357/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
|
> **sanitizeFilename**(`filename`, `options`): `string`
|
|
10
10
|
|
|
11
|
-
Defined in: [filename.ts:97](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [filename.ts:97](https://github.com/isdk/util.js/blob/4a17f40c6487cc8186e888c58b4e6268f4dcb357/src/filename.ts#L97)
|
|
12
12
|
|
|
13
13
|
Sanitizes a given filename by replacing invalid characters with a specified replacement character or a default.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **sanitizeFilepath**(`filepath`, `options`): `string`
|
|
10
10
|
|
|
11
|
-
Defined in: [filename.ts:149](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [filename.ts:149](https://github.com/isdk/util.js/blob/4a17f40c6487cc8186e888c58b4e6268f4dcb357/src/filename.ts#L149)
|
|
12
12
|
|
|
13
13
|
Sanitizes each part of a file path and reassembles it, ensuring the path is valid according to provided options.
|
|
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/4a17f40c6487cc8186e888c58b4e6268f4dcb357/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/4a17f40c6487cc8186e888c58b4e6268f4dcb357/src/to-camel-case.ts#L17)
|
|
12
12
|
|
|
13
13
|
Converts a string to camelCase.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **toCapitalCase**(`str`): `string`
|
|
10
10
|
|
|
11
|
-
Defined in: [to-capital-case.ts:17](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [to-capital-case.ts:17](https://github.com/isdk/util.js/blob/4a17f40c6487cc8186e888c58b4e6268f4dcb357/src/to-capital-case.ts#L17)
|
|
12
12
|
|
|
13
13
|
Converts a string to capital case, where the first letter of each word is capitalized
|
|
14
14
|
and the rest are in lowercase. Words are separated by spaces, hyphens, or underscores.
|
|
@@ -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/4a17f40c6487cc8186e888c58b4e6268f4dcb357/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/4a17f40c6487cc8186e888c58b4e6268f4dcb357/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:76](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [traverse-folder.ts:76](https://github.com/isdk/util.js/blob/4a17f40c6487cc8186e888c58b4e6268f4dcb357/src/traverse-folder.ts#L76)
|
|
12
12
|
|
|
13
13
|
Traverses a folder synchronously and applies a handler to each file or directory.
|
|
14
14
|
|
|
@@ -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/4a17f40c6487cc8186e888c58b4e6268f4dcb357/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/6db2d9183a
|
|
|
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/4a17f40c6487cc8186e888c58b4e6268f4dcb357/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/6db2d9183a
|
|
|
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/4a17f40c6487cc8186e888c58b4e6268f4dcb357/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/4a17f40c6487cc8186e888c58b4e6268f4dcb357/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/6db2d9183a0
|
|
|
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/4a17f40c6487cc8186e888c58b4e6268f4dcb357/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/6db2d9183a0
|
|
|
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/4a17f40c6487cc8186e888c58b4e6268f4dcb357/src/config-file.ts#L21)
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Interface: SanitizeFilenameOptions
|
|
8
8
|
|
|
9
|
-
Defined in: [filename.ts:83](https://github.com/isdk/util.js/blob/
|
|
9
|
+
Defined in: [filename.ts:83](https://github.com/isdk/util.js/blob/4a17f40c6487cc8186e888c58b4e6268f4dcb357/src/filename.ts#L83)
|
|
10
10
|
|
|
11
11
|
## Properties
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@ Defined in: [filename.ts:83](https://github.com/isdk/util.js/blob/6db2d9183a0020
|
|
|
14
14
|
|
|
15
15
|
> `optional` **maxLength**: `number`
|
|
16
16
|
|
|
17
|
-
Defined in: [filename.ts:85](https://github.com/isdk/util.js/blob/
|
|
17
|
+
Defined in: [filename.ts:85](https://github.com/isdk/util.js/blob/4a17f40c6487cc8186e888c58b4e6268f4dcb357/src/filename.ts#L85)
|
|
18
18
|
|
|
19
19
|
***
|
|
20
20
|
|
|
@@ -22,4 +22,4 @@ Defined in: [filename.ts:85](https://github.com/isdk/util.js/blob/6db2d9183a0020
|
|
|
22
22
|
|
|
23
23
|
> `optional` **replacement**: `string`
|
|
24
24
|
|
|
25
|
-
Defined in: [filename.ts:84](https://github.com/isdk/util.js/blob/
|
|
25
|
+
Defined in: [filename.ts:84](https://github.com/isdk/util.js/blob/4a17f40c6487cc8186e888c58b4e6268f4dcb357/src/filename.ts#L84)
|
|
@@ -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/4a17f40c6487cc8186e888c58b4e6268f4dcb357/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/4a17f40c6487cc8186e888c58b4e6268f4dcb357/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/4a17f40c6487cc8186e888c58b4e6268f4dcb357/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/4a17f40c6487cc8186e888c58b4e6268f4dcb357/src/include-files.ts#L1)
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> `const` **FilenameReservedRegex**: `RegExp`
|
|
10
10
|
|
|
11
|
-
Defined in: [filename.ts:8](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [filename.ts:8](https://github.com/isdk/util.js/blob/4a17f40c6487cc8186e888c58b4e6268f4dcb357/src/filename.ts#L8)
|
|
12
12
|
|
|
13
13
|
Regular expression pattern for reserved characters in a filename.
|
|
14
14
|
do not use /g global option here: when the regex is executed multiple times, it will always begin where it left off last time.
|
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
> `const` **WindowsReservedNameRegex**: `RegExp`
|
|
10
10
|
|
|
11
|
-
Defined in: [filename.ts:13](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [filename.ts:13](https://github.com/isdk/util.js/blob/4a17f40c6487cc8186e888c58b4e6268f4dcb357/src/filename.ts#L13)
|
|
12
12
|
|
|
13
13
|
Regular expression pattern for reserved names on Windows systems.
|