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

Create TypeScript Utility Package for Common Functions #1

Open
4 tasks
Keyrxng opened this issue May 20, 2024 · 9 comments
Open
4 tasks

Create TypeScript Utility Package for Common Functions #1

Keyrxng opened this issue May 20, 2024 · 9 comments

Comments

@Keyrxng
Copy link
Contributor

Keyrxng commented May 20, 2024

We need to create an npm package that provides a set of utility functions written in TypeScript. These functions will be useful for common tasks across our projects. The package should be well-tested, documented, and maintainable.

  1. stringUtils.capitalize(str: string): string
    • Capitalizes the first letter of a given string.
  2. arrayUtils.shuffle<T>(arr: T[]): T[]
    • Shuffles the elements of an array randomly.
  3. dateUtils.formatDate(date: Date, format: string): string
    • Formats a date object according to the specified format (e.g., "YYYY-MM-DD").
  4. mathUtils.calculateDiscount(originalPrice: number, discountPercentage: number): number
    • Calculates the discounted price based on the original price and discount percentage.

Acceptance Criteria

  • All utility functions are implemented and tested.
  • Documentation is provided for each function.
  • Code follows best practices and adheres to our coding standards.
  • Package is published on npm as @my-awesome-utils/core.
  1. Scope Clarification:

    • Instead of a generic utility package, let's focus on a specific area. For example, we could create a package specifically for handling date-related functions (@my-awesome-utils/dates).
    • This narrower scope will allow us to provide more specialized and well-tested functions.
  2. Function Naming Convention:

    • I recommend using a consistent naming convention for our utility functions. We can follow the pattern of moduleName.functionName.
    • For instance:
      • dates.formatDate(date: Date, format: string): string
      • dates.calculateAge(birthDate: Date): number

It seems that the author of the issue agrees with this approach. However, there is a comment that says "/rewrite" which suggests that the issue may need to be rewritten. It is unclear what exactly needs to be rewritten, so further clarification may be needed.

No linked issues or pull requests were found in the conversation.

Based on the information provided, it is recommended to update the issue spec to include the scope clarification and function naming convention. If there is a need to rewrite the issue, it should be discussed further to determine the specific changes required.

@keyrxng2
Copy link

I think it's best if we follow this approach with things

  1. Scope Clarification:

    • Instead of a generic utility package, let's focus on a specific area. For example, we could create a package specifically for handling date-related functions (@my-awesome-utils/dates).
    • This narrower scope will allow us to provide more specialized and well-tested functions.
  2. Function Naming Convention:

    • I recommend using a consistent naming convention for our utility functions. We can follow the pattern of moduleName.functionName.
    • For instance:
      • dates.formatDate(date: Date, format: string): string
      • dates.calculateAge(birthDate: Date): number

@Keyrxng
Copy link
Contributor Author

Keyrxng commented May 20, 2024

I agree with this approach

@ubq-testing ubq-testing deleted a comment from github-actions bot May 20, 2024
@ubq-testing ubq-testing deleted a comment from github-actions bot May 20, 2024
@ubq-testing ubq-testing deleted a comment from github-actions bot May 20, 2024
@ubq-testing ubq-testing deleted a comment from github-actions bot May 20, 2024
@ubq-testing ubq-testing deleted a comment from github-actions bot May 20, 2024
@Keyrxng
Copy link
Contributor Author

Keyrxng commented May 20, 2024

I think each module should have it's own issue that way we keep prs small

@ubq-testing ubq-testing deleted a comment from github-actions bot May 20, 2024
@keyrxng2
Copy link

I'll work on the dates and math modules, @Keyrxng can you do the rest?

@Keyrxng
Copy link
Contributor Author

Keyrxng commented May 20, 2024

Fine by me, let's get a task list going with who is assigned to what

@ubq-testing ubq-testing deleted a comment from github-actions bot May 20, 2024
@ubq-testing ubq-testing deleted a comment from github-actions bot May 20, 2024
@Keyrxng
Copy link
Contributor Author

Keyrxng commented May 20, 2024

/rewrite

Copy link

Spec updated successfully

@ubq-testing ubq-testing deleted a comment from github-actions bot May 20, 2024
@Keyrxng
Copy link
Contributor Author

Keyrxng commented May 20, 2024

/rewrite

Copy link

Spec updated successfully

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants