Skip to content

Conversation

@kaushal-kumar-it
Copy link
Contributor

Resolves #8482

Description

What is the purpose of this pull request?

This pull request implements the RFC proposing the addition of the symbol/to-string-tag package.

The package is modeled after existing symbol utilities in the repository, including:

  • symbol/has-instance
  • symbol/iterator
  • symbol/async-iterator
  • symbol/is-concat-spreadable

The new package exports Symbol.toStringTag when available in the current environment.

Additional implementation details include:

  • copying one of the existing symbol packages as a template
  • renaming the package directory and files accordingly
  • replacing identifiers throughout the package
    (e.g., has-instanceto-string-tag, HasInstanceSymbolToStringTagSymbol)
  • ensuring the copyright year is 2025
  • updating descriptions based on MDN documentation for Symbol.toStringTag
  • updating examples to reflect the symbol's intended usage
  • running tests, benchmarks, and examples to verify correctness
  • checking for any copy-paste errors

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

  • None.

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Documentation (including examples)
  • [] Research and understanding
  • Code generation
  • Test/benchmark generation

Disclosure

This PR includes descriptive text drafted with the assistance of ChatGPT to ensure that the RFC details and PR documentation are clear and complete. All code changes were written and validated manually.


@stdlib-js/reviewers

@stdlib-bot stdlib-bot added Needs Review A pull request which needs code review. Good First PR A pull request resolving a Good First Issue. labels Nov 10, 2025
@stdlib-bot
Copy link
Contributor

stdlib-bot commented Nov 10, 2025

Coverage Report

Package Statements Branches Functions Lines
symbol/to-string-tag $\color{green}103/103$
$color{green}+100.00%$
$\color{red}2/3$
$color{green}+66.67%$
$\color{green}0/0$
$color{green}+100.00%$
$\color{green}103/103$
$color{green}+100.00%$

The above coverage report was generated for the changes in this PR.

*
* ## Notes
*
* - This symbol is used to determine whether a constructor object recognizes an object as its instance.
Copy link
Member

Choose a reason for hiding this comment

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

Copy-paste mistake.

// EXPORTS //

/**
* Has instance symbol.
Copy link
Member

Choose a reason for hiding this comment

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

Copy-paste mistake.

};
}

function toStringTag( instance ) {
Copy link
Member

Choose a reason for hiding this comment

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

This example needs to be updated to match the README.

* };
* };
*
* ArrayLike[ ToStringTagSymbol ] = isArray;
Copy link
Member

Choose a reason for hiding this comment

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

Same thing. This example needs to be updated.

'use strict';

/**
* Symbol used to determine if a constructor object recognizes an object as its instance.
Copy link
Member

Choose a reason for hiding this comment

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

Copy-paste mistake.

* @type {(symbol|null)}
*
* @example
* var isArray = require( '@stdlib/assert/is-array' );
Copy link
Member

Choose a reason for hiding this comment

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

Example needs updating.

{
"name": "@stdlib/symbol/to-string-tag",
"version": "0.0.0",
"description": "Has `Symbol.toStringTag` symbol.",
Copy link
Member

Choose a reason for hiding this comment

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

Description needs updating.

Copy link
Member

@kgryte kgryte left a comment

Choose a reason for hiding this comment

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

Left initial comments.

@kgryte kgryte added Feature Issue or pull request for adding a new feature. Needs Changes Pull request which needs changes before being merged. and removed Needs Review A pull request which needs code review. labels Nov 18, 2025
@kgryte kgryte changed the title feat: add symbol/to-string-tag package feat: add symbol/to-string-tag Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Issue or pull request for adding a new feature. Good First PR A pull request resolving a Good First Issue. Needs Changes Pull request which needs changes before being merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC]: add symbol/to-string-tag

3 participants