Skip to content

Add TypeScript definitions and non-throwing variants for validator#1345

Merged
mahmoud-ghalayini merged 1 commit into
RobotWebTools:developfrom
mahmoud-ghalayini:add-typescript-definitions-and-non-throwing-variants-for-validator-1344
Dec 9, 2025
Merged

Add TypeScript definitions and non-throwing variants for validator#1345
mahmoud-ghalayini merged 1 commit into
RobotWebTools:developfrom
mahmoud-ghalayini:add-typescript-definitions-and-non-throwing-variants-for-validator-1344

Conversation

@mahmoud-ghalayini

Copy link
Copy Markdown
Contributor

Public API Changes

Added non-throwing validator variants to rclnodejs.validator:

  • isValidFullTopicName(topic: string): boolean
  • isValidNodeName(name: string): boolean
  • isValidTopicName(topic: string): boolean
  • isValidNamespace(namespace: string): boolean

Added TypeScript definitions for all validator methods in types/validator.d.ts.

#1344

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 82.83% (+0.1%) from 82.728%
when pulling e7ca09e on mahmoud-ghalayini:add-typescript-definitions-and-non-throwing-variants-for-validator-1344
into e610950 on RobotWebTools:develop.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds non-throwing validator variants and TypeScript definitions to the rclnodejs validator module, addressing issue #1344.

Summary: The PR introduces boolean-returning validator functions (isValid*) that complement the existing throwing validators, along with complete TypeScript type definitions for all validator functions.

Key Changes:

  • Added four new non-throwing validator functions: isValidFullTopicName, isValidNodeName, isValidTopicName, and isValidNamespace
  • Created comprehensive TypeScript definitions in types/validator.d.ts with detailed documentation
  • Updated JSDoc comments for existing validator functions to improve clarity and consistency

Reviewed changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated no comments.

File Description
types/validator.d.ts New file containing TypeScript definitions for all validator functions with comprehensive JSDoc documentation
types/base.d.ts Added reference path to include the new validator type definitions
lib/validator.js Implemented four new non-throwing validator functions and updated JSDoc comments for existing functions
test/test-validator.js Added comprehensive test suites for all four new non-throwing validator functions covering valid, invalid, and edge cases

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@minggangw minggangw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks a lot!

@mahmoud-ghalayini mahmoud-ghalayini merged commit 31aa851 into RobotWebTools:develop Dec 9, 2025
26 of 28 checks passed
minggangw pushed a commit that referenced this pull request Jan 6, 2026
…1345)

- Add complete TypeScript definitions for all validator methods (types/validator.d.ts)
- Add isValidFullTopicName(), isValidNodeName(), isValidTopicName(), isValidNamespace() methods that return boolean instead of throwing
- Non-throwing variants enable simple conditional checks without try/catch blocks
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.

4 participants