diff --git a/README.md b/README.md index 295493b..17905b7 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ The primary benefit of this library is that all implemented APIs execute asynchr therefore ensuring their execution will **NOT** block any other processes. > [!IMPORTANT]\ -> Currently this project only focus on CommonJS (CJS) and ES Modules (ESM). +> Currently this project only focus on CommonJS (CJS) and ECMAScript Modules (ESM). ## APIs @@ -123,8 +123,8 @@ ls(dirpath, options, lsTypes.LS_F); Returns a promise that resolves to an array of string containing the entries result. It can be `null` if an error occurred while listing a directory, or returns a -promise with an empty array if any files and directories doesn't match with the -specified filter options. +promise with an empty array if any files doesn't match with the specified filter +options. > [!NOTE]\ > 💡 **Tip**: You can combine options for more granular control. For example, @@ -180,8 +180,8 @@ ls(dirpath, options, lsTypes.LS_D); Returns a promise that resolves to an array of string containing the entries result. It can be `null` if an error occurred while listing a directory, or returns a -promise with an empty array if any files and directories doesn't match with the -specified filter options. +promise with an empty array if any directories doesn't match with the specified +filter options.
Example Usage (CJS) diff --git a/src/lsfnd.ts b/src/lsfnd.ts index cf05a04..780c9f6 100644 --- a/src/lsfnd.ts +++ b/src/lsfnd.ts @@ -88,7 +88,9 @@ export enum lsTypes { * (including regular files and directories). * See {@link lsTypes} to check all supported types. * - * @returns A promise that resolves with an array of matched file paths. + * @returns A promise that resolves with an array of string representing the + * entries result or an empty array if any files and directories doesn't + * match with the specified filter options. * @throws {Error} If there is an error occurred while reading a directory. * * @example @@ -204,7 +206,9 @@ export async function ls( * @param dirpath - The directory path to search. * @param options - Additional options for reading the directory. * - * @returns A promise that resolves with an array of matched file paths. + * @returns A promise that resolves with an array of string representing the + * entries result or an empty array if any files doesn't match with + * the specified filter options. * @throws {Error} If there is an error occurred while reading a directory. * * @example @@ -254,7 +258,9 @@ export async function lsFiles( * @param dirpath - The directory path to search. * @param options - Additional options for reading the directory. * - * @returns A promise that resolves with an array of matched file paths. + * @returns A promise that resolves with an array of string representing the + * entries result or an empty array if any directories doesn't match + * with the specified filter options. * @throws {Error} If there is an error occurred while reading a directory. * * @example diff --git a/types/index.d.ts b/types/index.d.ts index 3484942..61e2484 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -44,11 +44,8 @@ export declare const lsTypes: LsTypes; export declare type LsTypesKeys = keyof LsTypes; /** * Type representing all possible values of the {@link lsTypes} enum. - * - * This type contains all possible values for `type` argument in {@link lsfnd!~ls} - * function with numeric representations using bitwise operators for clarity and - * potential bit manipulation use cases. * @since 0.1.0 + * @see {@link LsTypes} */ export declare type LsTypesValues = | 0b00 // 0 (interpreted the same as LS_A | 1) @@ -59,7 +56,6 @@ export declare type LsTypesValues = /** * Interface defining the {@link lsTypes} enum with string literal keys * representing different file types and their corresponding numeric values. - * @internal * @readonly * @interface * @since 0.1.0 @@ -90,7 +86,7 @@ export declare interface LsTypes { */ export declare interface LsOptions { /** - * Specifies the character encoding to be used when reading file contents. + * Specifies the character encoding to be used when reading a directory. * @defaultValue Defaults to `'utf8'` if not provided. */ encoding?: BufferEncoding | undefined, @@ -101,8 +97,7 @@ export declare interface LsOptions { recursive?: boolean | undefined, /** * A regular expression or string pattern used to filter the listed entries. - * Only entries matching the pattern (filename or path) will be included - * in the results. + * Only entries matching the pattern will be included in the results. * @defaultValue `/.+/` (match all files) */ match?: RegExp | string | undefined,