Skip to content

feat: add symbol/to-string-tag - #8491

Open
kaushal-kumar-it wants to merge 8 commits into
stdlib-js:developfrom
kaushal-kumar-it:rfc-add-symbol-to-string-tag
Open

kaushal-kumar-it wants to merge 8 commits into
stdlib-js:developfrom
kaushal-kumar-it:rfc-add-symbol-to-string-tag

Conversation

@kaushal-kumar-it

Copy link
Copy Markdown
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-instance → to-string-tag, HasInstanceSymbol → ToStringTagSymbol)
  • 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

stdlib-bot commented Nov 10, 2025 •

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
symbol/to-string-tag $\color{green}99/99$
$color{green}+100.00%$
$\color{red}2/3$
$color{green}+66.67%$
$\color{green}0/0$
$color{green}+100.00%$
$\color{green}99/99$
$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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

Choose a reason for hiding this comment

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

Description needs updating.

@kgryte kgryte 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.

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
@kaushal-kumar-it

Copy link
Copy Markdown
Contributor Author

@kgryte i have fixed all copy-paste errors pls review it whenever you get time .

@stdlib-bot stdlib-bot added Potential Duplicate There might be another pull request resolving the same issue. and removed Potential Duplicate There might be another pull request resolving the same issue. labels Jan 7, 2026
@stdlib-bot stdlib-bot added the Potential Duplicate There might be another pull request resolving the same issue. label Jul 26, 2026

This branch has not been deployed

No deployments
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. Potential Duplicate There might be another pull request resolving the same issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants