Skip to content

Conversation

@ryasmi
Copy link
Owner

@ryasmi ryasmi commented Nov 8, 2024

Add a function to validate number ranges and corresponding tests.

  • New Functionality: Add numberRange function in src/valueRules/numberRange/numberRange.ts to validate if a number is within a specified range and return a constrained type with a unique symbol for each range.
  • Error Handling: Implement InvalidNumberRangeError to throw an error if the number is not within the specified range.
  • Tests: Add tests in src/valueRules/numberRange/numberRange.test.ts to validate the numberRange function with various inputs, including edge cases and type constraints.
  • Exports: Modify src/rulr.ts to export the numberRange function and InvalidNumberRangeError.

For more details, open the Copilot Workspace session.

Add a function to validate number ranges and corresponding tests.

* **New Functionality**: Add `numberRange` function in `src/valueRules/numberRange/numberRange.ts` to validate if a number is within a specified range and return a constrained type with a unique symbol for each range.
* **Error Handling**: Implement `InvalidNumberRangeError` to throw an error if the number is not within the specified range.
* **Tests**: Add tests in `src/valueRules/numberRange/numberRange.test.ts` to validate the `numberRange` function with various inputs, including edge cases and type constraints.
* **Exports**: Modify `src/rulr.ts` to export the `numberRange` function and `InvalidNumberRangeError`.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/ryasmi/rulr?shareId=XXXX-XXXX-XXXX-XXXX).
* **numberRange function**: Define and implement `numberRange` function in `src/ruleConstructors/numberRange/numberRange.ts` to validate if a number is within a specified range, throwing an error if not.
* **Tests**: Add tests in `src/ruleConstructors/numberRange/numberRange.test.ts` to validate the `numberRange` function with various inputs, including edge cases and constrained type checks.
* **Export**: Change `src/rulr.ts` to import and export the `numberRange` function from the new file.
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

Successfully merging this pull request may close these issues.

1 participant