Skip to content

feat(core): Implement comprehensive type-guard utilities for runtime … #1

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

Merged
merged 1 commit into from
Feb 24, 2025

Conversation

m-mdy-m
Copy link
Member

@m-mdy-m m-mdy-m commented Feb 24, 2025

…type validation

Core TypeGuardMap interface defining 40+ type validation signatures

  • Complete type guard implementations covering:
    • JavaScript primitives (string, number, boolean, etc.)
    • Special number cases (NaN, Infinity, integer, etc.)
    • Structural types (object, array, function, etc.)
    • Collection types (Map, Set, WeakMap, etc.)
    • Utility checks (nil, empty, truthy, etc.)
  • Documentation (docs/api/type-guard.doc.md) detailing all type guards with usage examples
  • Full type safety throughout all guard implementations
  • Support for edge cases:
    • Primitive wrapper objects (new String(), new Number(), etc.)
    • Custom constructor validation
    • Promise-like object detection
    • Iterable protocol compliance

This foundational implementation establishes @medishn/toolkit's type validation module, providing robust runtime type checking while maintaining strict type safety. The solution serves as core infrastructure for subsequent toolkit expansions, enabling safer data manipulation patterns across the codebase.

View Documentation

…type validation

 Core `TypeGuardMap` interface defining 40+ type validation signatures
- Complete type guard implementations covering:
  - JavaScript primitives (`string`, `number`, `boolean`, etc.)
  - Special number cases (`NaN`, `Infinity`, `integer`, etc.)
  - Structural types (`object`, `array`, `function`, etc.)
  - Collection types (`Map`, `Set`, `WeakMap`, etc.)
  - Utility checks (`nil`, `empty`, `truthy`, etc.)
- Documentation (`docs/api/type-guard.doc.md`) detailing all type guards with usage examples
- Full type safety throughout all guard implementations
- Support for edge cases:
  - Primitive wrapper objects (`new String()`, `new Number()`, etc.)
  - Custom constructor validation
  - Promise-like object detection
  - Iterable protocol compliance

This foundational implementation establishes @medishn/toolkit's type validation module, providing robust runtime type checking while maintaining strict type safety. The solution serves as core infrastructure for subsequent toolkit expansions, enabling safer data manipulation patterns across the codebase.

[View Documentation](docs/api/type-guard.doc.md)
@bitsgenix bitsgenix self-requested a review February 24, 2025 02:37
Copy link
Member

@bitsgenix bitsgenix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merged

@m-mdy-m m-mdy-m merged commit a0e59d1 into main Feb 24, 2025
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.

2 participants