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

🚧Add options to get variables function #43

Open
2 of 11 tasks
CalvinWilkinson opened this issue Feb 23, 2024 · 0 comments
Open
2 of 11 tasks

🚧Add options to get variables function #43

CalvinWilkinson opened this issue Feb 23, 2024 · 0 comments
Assignees
Labels
medium-priority Medium Priority ✨new-feature New feature that does not exist

Comments

@CalvinWilkinson
Copy link
Member

CalvinWilkinson commented Feb 23, 2024

Complete The Item Below

  • I have updated the title without removing the 🚧 emoji.

Description

Add some options to the getVariables() function in the RepoClient and OrgClient class. These options will be used to signify how to trim the variable values.

Add the following options:

  1. Add the ability to trim spaces, \n, and \r characters from the beginning and end of the variable values.
  2. Add the ability to return all of the values in uppercase or lowercase

Each option should be available and performed using an enum. The different enum values will represent a different trimming behavior.

Here are the trimming behaviors:

Warning

Do not use a standard typescript enum. This has some pitfalls and it is recommended to do something different.
More info about this can be found here

const TrimType = {
    TrimNL: "TrimNL",
    TrimNLStart: "TrimNLStart",
    TrimNLEnd: "TrimNLEnd",
    TrimCR: "TrimCR",
    TrimCRStart: "TrimCRStart",
    TrimCREnd: "TrimCREnd",
    TrimNLAndCR: "TrimNLAndCR",
    TrimNLAndCRStart: "TrimNLAndCRStart",
    TrimNLAndCREnd: "TrimNLAndCREnd",
    TrimSpaces: "TrimSpaces",
    TrimSpacesStart: "TrimSpacesStart",
    TrimSpacesEnd: "TrimSpacesEnd",
    TrimAllSpacesAndNLCR: "TrimAllSpacesAndNLCR",
	None: "None",
} as const; // This prevents the object from being mutated

type EnumValues<T> = T[keyof T];
type TrimType = EnumValues<typeof TrimType>;

// Use Examples Below

// How to use
function trim(trimType: TrimType) {
    console.log(trimType);
}

trim(TrimType.TrimCR);

// OR

trim("TrimCR");

Options Object Type:

type ValueOptions = {
    trimming?: TrimType,
    casing?: 'lower-case' | 'upper-case',
}

Note

NL = New Line = \n
CR = Carriage Return = \r

Acceptance Criteria

The items to complete to satisfy the Definition of Done.

ToDo Items

The items to complete to satisfy the Definition of Done.

Issue Dependencies

No response

Related Work

No response

Additional Information:

Unit Tests

Reasons for local unit test execution:

  • Unit tests might pass locally but not in the CI environment during the status check process or vice-versa.
  • Tests might pass on the developer's machine but not necessarily on the code reviewer's machine.
  • If you notice that the test status check has passed but the test failed locally, please notify a project maintainer!

💡Warning💡
If the unit tests pass remotely and are not executed locally, this means we could be letting a bug slip into production.
Though bugs will always exist in some capacity, we should all do our part to help prevent them from happening.

Change Type Labels

Change Type Label
Bug Fixes 🐛bug
Breaking Changes 🧨breaking changes
New Feature ✨new feature
CICD Changes ♻️cicd
Config Changes ⚙️config
Performance Improvements 🏎️performance
Code Doc Changes 🗒️documentation/code
Product Doc Changes 📝documentation/product

Priority Type Labels

Priority Type Label
Low Priority low priority
Medium Priority medium priority
High Priority high priority

Code of Conduct

  • I agree to follow this project's Code of Conduct.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
medium-priority Medium Priority ✨new-feature New feature that does not exist
Projects
Status: ⚪Not Set
Development

No branches or pull requests

1 participant