@isdk/util 0.3.0 → 0.3.1
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 +17 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/docs/classes/ConfigFile.md +5 -5
- package/docs/functions/arrayHasAll.md +48 -0
- 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 +1 -1
- 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/globals.md +1 -0
- 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
|
@@ -421,4 +421,20 @@ declare function sanitizeFilepath(filepath: string, options?: SanitizeFilenameOp
|
|
|
421
421
|
*/
|
|
422
422
|
declare function extNameLevel(extName: string): number;
|
|
423
423
|
|
|
424
|
-
|
|
424
|
+
/**
|
|
425
|
+
* Checks whether the provided array contains all of the specified elements.
|
|
426
|
+
*
|
|
427
|
+
* @typeParam T - The type of elements in the arrays.
|
|
428
|
+
* @param array - The array to check against.
|
|
429
|
+
* @param elements - The list of elements to be checked for presence in the array.
|
|
430
|
+
* @returns `true` if all elements are present in the array; otherwise, `false`.
|
|
431
|
+
*
|
|
432
|
+
* @example
|
|
433
|
+
* ```ts
|
|
434
|
+
* arrayHasAll([1, 2, 3], [2, 3]); // true
|
|
435
|
+
* arrayHasAll(['a', 'b', 'c'], ['x', 'y']); // false
|
|
436
|
+
* ```
|
|
437
|
+
*/
|
|
438
|
+
declare function arrayHasAll<T = any>(array: T[], elements: T[]): boolean;
|
|
439
|
+
|
|
440
|
+
export { ConfigFile, DefaultAllTextFiles, FilenameReservedRegex, type IncludeFiles, type LoadConfigFileOptions, type SanitizeFilenameOptions, type StringifyFunc, type TraverseFolderHandler, type TraverseFolderSyncHandler, WindowsReservedNameRegex, arrayHasAll, extNameLevel, filenameReservedRegex, getMultiLevelExtname, glob, isStringIn, isValidFilename, isValidFilepath, normalizeIncludeFiles, parseFrontMatter, parseYaml, reControlCharsRegex, registerYamlTag, removeLeadingEmptyLines, sanitizeFilename, sanitizeFilepath, stringifyYaml, toCamelCase, toCapitalCase, toPascalCase, traverseFolder, traverseFolderSync };
|
package/dist/index.d.ts
CHANGED
|
@@ -421,4 +421,20 @@ declare function sanitizeFilepath(filepath: string, options?: SanitizeFilenameOp
|
|
|
421
421
|
*/
|
|
422
422
|
declare function extNameLevel(extName: string): number;
|
|
423
423
|
|
|
424
|
-
|
|
424
|
+
/**
|
|
425
|
+
* Checks whether the provided array contains all of the specified elements.
|
|
426
|
+
*
|
|
427
|
+
* @typeParam T - The type of elements in the arrays.
|
|
428
|
+
* @param array - The array to check against.
|
|
429
|
+
* @param elements - The list of elements to be checked for presence in the array.
|
|
430
|
+
* @returns `true` if all elements are present in the array; otherwise, `false`.
|
|
431
|
+
*
|
|
432
|
+
* @example
|
|
433
|
+
* ```ts
|
|
434
|
+
* arrayHasAll([1, 2, 3], [2, 3]); // true
|
|
435
|
+
* arrayHasAll(['a', 'b', 'c'], ['x', 'y']); // false
|
|
436
|
+
* ```
|
|
437
|
+
*/
|
|
438
|
+
declare function arrayHasAll<T = any>(array: T[], elements: T[]): boolean;
|
|
439
|
+
|
|
440
|
+
export { ConfigFile, DefaultAllTextFiles, FilenameReservedRegex, type IncludeFiles, type LoadConfigFileOptions, type SanitizeFilenameOptions, type StringifyFunc, type TraverseFolderHandler, type TraverseFolderSyncHandler, WindowsReservedNameRegex, arrayHasAll, extNameLevel, filenameReservedRegex, getMultiLevelExtname, glob, isStringIn, isValidFilename, isValidFilepath, normalizeIncludeFiles, parseFrontMatter, parseYaml, reControlCharsRegex, registerYamlTag, removeLeadingEmptyLines, sanitizeFilename, sanitizeFilepath, stringifyYaml, toCamelCase, toCapitalCase, toPascalCase, traverseFolder, traverseFolderSync };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,
|
|
1
|
+
"use strict";var e,t=Object.create,n=Object.defineProperty,r=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 u of o(t))s.call(e,u)||u===i||n(e,u,{get:()=>t[u],enumerable:!(a=r(t,u))||a.enumerable});return e},u=(e,r,o)=>(o=null!=e?t(i(e)):{},a(!r&&e&&e.__esModule?o:n(o,"default",{value:e,enumerable:!0}),e)),c={};((e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})})(c,{ConfigFile:()=>j,DefaultAllTextFiles:()=>O,FilenameReservedRegex:()=>B,WindowsReservedNameRegex:()=>D,arrayHasAll:()=>X,extNameLevel:()=>U,filenameReservedRegex:()=>P,getMultiLevelExtname:()=>g,glob:()=>R,isStringIn:()=>E,isValidFilename:()=>Z,isValidFilepath:()=>G,normalizeIncludeFiles:()=>A,parseFrontMatter:()=>w,parseYaml:()=>h,reControlCharsRegex:()=>W,registerYamlTag:()=>v,removeLeadingEmptyLines:()=>b,sanitizeFilename:()=>K,sanitizeFilepath:()=>Q,stringifyYaml:()=>F,toCamelCase:()=>N,toCapitalCase:()=>M,toPascalCase:()=>T,traverseFolder:()=>k,traverseFolderSync:()=>L}),module.exports=(e=c,a(n({},"__esModule",{value:!0}),e));var f=require("fs"),l=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 w(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 o=r.slice(n,e);for(e+=t.length+1;"\n"===r[e]||"\r"===r[e];)e++;const i=r.slice(e);return{data:h(o)||{},content:i}}}return{data:{},content:e}}var j=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 o=m.Config.loadSync(e);if(!o&&n){if(!l.default.isAbsolute(n)){const t=l.default.dirname(e);n=l.default.join(t,n)}if((0,f.existsSync)(n)){const e=w((0,f.readFileSync)(n,"utf8")).data;Object.keys(e).length&&(o=e)}}return o}(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 o=j.stringifys[r];if(!o)throw new Error(`${e} unsupported mime type: ${r}`);t=o(t);const i=l.default.dirname(e);(0,f.existsSync)(i)||(0,f.mkdirSync)(i,{recursive:!0});return(0,f.writeFileSync)(e,t,{encoding:"utf8"}),e}(e,t,n)}};j.stringifys={},j.register([".yml",".yaml"],h,F),j.register([".json"],(function(e){return JSON.parse(e)}),(e=>JSON.stringify(e,null,2)));var q=require("@isdk/glob"),$=u(require("path"));function R(e,t,n){return n&&(e=$.default.relative(n,e)),(0,q.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 A(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 C=require("fs/promises"),S=require("fs"),z=u(require("path"));async function k(e,t){const n=await(0,C.readdir)(e,{withFileTypes:!0});for(const r of n){const n=z.default.join(e,r.name);try{if(r.isDirectory()){await t(n,r)||await k(n,t)}else{if(!0===await t(n,r))break}}catch(e){console.error(`Error processing file: ${n}`),console.error(e)}}}function L(e,t){const n=(0,S.readdirSync)(e,{withFileTypes:!0});for(const r of n){const n=z.default.join(e,r.name);try{if(r.isDirectory()){t(n,r)||k(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=/\.+$/,H=/[\u0000-\u001F\u0080-\u009F\u200E\u200F\u202A-\u202E\u2066-\u2069]/;function P(){return new RegExp(B.source,"g")}function W(){return new RegExp(H.source,"g")}function Z(e){return e&&!(B.test(e)||W().test(e)||J.test(e)||V.test(e))}function G(e){const t=e.split(_.default.sep);return("/"===e[0]||t[0]&&_.default.dirname(t[0])===t[0])&&t.shift(),t.every(Z)}function K(e,t={}){const n=t.replacement||"!";if((B.test(n)||H.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(P(),n)).replace(W(),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),o=e.slice(t);e=n.slice(0,Math.max(1,r-o.length))+o}}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 o=n.map((e=>K(e,t)));return void 0!==r&&o.unshift(r),o.join(_.default.sep)}function U(e){return e.split(".").length-1}function X(e,t){const n=new Set(t),r=new Set;for(const t of e)if(n.has(t)&&(r.add(t),r.size===n.size))return!0;return r.size===n.size}
|
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
|
|
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 w(t,n,o){return o&&(t=x.relative(o,t)),d(t,n)}function v(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 S(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=S(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}function K(t,n){const o=new Set(n),r=new Set;for(const n of t)if(o.has(n)&&(r.add(n),r.size===o.size))return!0;return r.size===o.size}export{h as ConfigFile,$ as DefaultAllTextFiles,B as FilenameReservedRegex,J as WindowsReservedNameRegex,K as arrayHasAll,I as extNameLevel,D as filenameReservedRegex,f as getMultiLevelExtname,w as glob,v 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,z as toCamelCase,T as toCapitalCase,S 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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/src/config-file.ts#L102)
|
|
136
136
|
|
|
137
137
|
Saves a configuration object to a file with the specified filename and options.
|
|
138
138
|
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
[**@isdk/util**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/util](../globals.md) / arrayHasAll
|
|
6
|
+
|
|
7
|
+
# Function: arrayHasAll()
|
|
8
|
+
|
|
9
|
+
> **arrayHasAll**\<`T`\>(`array`, `elements`): `boolean`
|
|
10
|
+
|
|
11
|
+
Defined in: [array-has-all.ts:15](https://github.com/isdk/util.js/blob/37cf8e647afe115375188dc281429b45345985c4/src/array-has-all.ts#L15)
|
|
12
|
+
|
|
13
|
+
Checks whether the provided array contains all of the specified elements.
|
|
14
|
+
|
|
15
|
+
## Type Parameters
|
|
16
|
+
|
|
17
|
+
### T
|
|
18
|
+
|
|
19
|
+
`T` = `any`
|
|
20
|
+
|
|
21
|
+
The type of elements in the arrays.
|
|
22
|
+
|
|
23
|
+
## Parameters
|
|
24
|
+
|
|
25
|
+
### array
|
|
26
|
+
|
|
27
|
+
`T`[]
|
|
28
|
+
|
|
29
|
+
The array to check against.
|
|
30
|
+
|
|
31
|
+
### elements
|
|
32
|
+
|
|
33
|
+
`T`[]
|
|
34
|
+
|
|
35
|
+
The list of elements to be checked for presence in the array.
|
|
36
|
+
|
|
37
|
+
## Returns
|
|
38
|
+
|
|
39
|
+
`boolean`
|
|
40
|
+
|
|
41
|
+
`true` if all elements are present in the array; otherwise, `false`.
|
|
42
|
+
|
|
43
|
+
## Example
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
arrayHasAll([1, 2, 3], [2, 3]); // true
|
|
47
|
+
arrayHasAll(['a', 'b', 'c'], ['x', 'y']); // false
|
|
48
|
+
```
|
|
@@ -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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/src/traverse-folder.ts#L76)
|
|
12
12
|
|
|
13
13
|
Traverses a folder synchronously and applies a handler to each file or directory.
|
|
14
14
|
|
package/docs/globals.md
CHANGED
|
@@ -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/37cf8e647afe115375188dc281429b45345985c4/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/4a17f40c64
|
|
|
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/37cf8e647afe115375188dc281429b45345985c4/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/4a17f40c64
|
|
|
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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/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/4a17f40c648
|
|
|
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/37cf8e647afe115375188dc281429b45345985c4/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/4a17f40c648
|
|
|
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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/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/4a17f40c6487cc
|
|
|
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/37cf8e647afe115375188dc281429b45345985c4/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/4a17f40c6487cc
|
|
|
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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/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/37cf8e647afe115375188dc281429b45345985c4/src/filename.ts#L13)
|
|
12
12
|
|
|
13
13
|
Regular expression pattern for reserved names on Windows systems.
|