Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ls): Allow string types for type arg & improve type safety #4

Merged
merged 6 commits into from
Apr 20, 2024

Commits on Apr 20, 2024

  1. fix: Fix unrecognized type when using the string value

    Previously, if using the string value of `lsTypes` enum (e.g., 'LS_F') the `ls` function can't recognizes it correctly and ignore it, thus causing the returned value is the undesired entries result. This change is to address the issue and now the `ls` function correctly recognized the string value of `lsTypes` enum, improving flexibility to the function.
    
    As of this change, you can now call the `ls` function with less code and more flexible:
    
      const files = await ls('./foo', {}, 'LS_F');
    mitsuki31 committed Apr 20, 2024
    Configuration menu
    Copy the full SHA
    04dec13 View commit details
    Browse the repository at this point in the history
  2. refactor: Improve the type argument checker

    In the last change we have configured the `ls` function to accepts the string value representing the `lsTypes` property names as value of `type` argument. This change brings the type argument checker to more strict and prevent from unintended values. In addition to this change, a new helper function called `checkType` has been defined to checks and verifies the type argument and compare it with the valid types.
    mitsuki31 committed Apr 20, 2024
    Configuration menu
    Copy the full SHA
    827c2bb View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d556337 View commit details
    Browse the repository at this point in the history
  4. docs: Improve the APIs docs and add link references

    This change updated and improved the APIs docs and also added link references for error classes that might be thrown by the APIs.
    mitsuki31 committed Apr 20, 2024
    Configuration menu
    Copy the full SHA
    084a48c View commit details
    Browse the repository at this point in the history
  5. test: Add several test cases

    - Added a test to check whether the `options` argument of APIs allows explicit `null` value
    - Added a test to check whether the `ls` function accepts a string value of `lsTypes` property names as value of `type` argument
    - Added a test to check the `ls` function correctly throws a `TypeError` if the given `type` argument is an unexpected value
    mitsuki31 committed Apr 20, 2024
    Configuration menu
    Copy the full SHA
    87d9c54 View commit details
    Browse the repository at this point in the history
  6. chore: Change the text color for better readability

    A small change to `simpletest` library, changed the text description color for success test cases to a bit darker, but keep the description color for failed test cases to default white. This allows developers and users to focus on where the failed tests have occurred (if any).
    mitsuki31 committed Apr 20, 2024
    Configuration menu
    Copy the full SHA
    27c2c2c View commit details
    Browse the repository at this point in the history