Skip to content

Commit

Permalink
docs: Update and fix missleading description
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuki31 committed Apr 14, 2024
1 parent e593ff9 commit 5d521e8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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.

<details>
<summary>Example Usage (CJS)</summary>
Expand Down
12 changes: 9 additions & 3 deletions src/lsfnd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
11 changes: 3 additions & 8 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 5d521e8

Please sign in to comment.