Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on Apr 12, 2024 via pnpm

has-tostringtag 1.0.0

Determine if the JS environment has `Symbol.toStringTag` support. Supports spec, or shams.
Package summary
Share
0
issues
1
license
2
MIT
Package created
5 Aug 2021
Version published
5 Aug 2021
Maintainers
1
Total deps
2
Direct deps
1
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
2 Packages, Including:
has-symbols@1.0.3
has-tostringtag@1.0.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

1
All Dependencies CSV
β“˜ This is a list of has-tostringtag 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
has-symbols1.0.36.9 kBMIT
prod

Visualizations

Frequently Asked Questions

What does has-tostringtag do?

"has-tostringtag" is a JavaScript utility function that helps developers identify if the JavaScript environment they are working in supports Symbol.toStringTag. The Symbol.toStringTag feature is critical in defining a user-defined string value in a JavaScript object's default description. The acknowledgement of a valid Symbol.toStringTag support ensures functions like Object.prototype.toString can provide expected results. It can identify both spec-compliant symbols and shams (pseudo implementations).

How do you use has-tostringtag?

You can use "has-tostringtag" package easily in your JavaScript project. To get started, first install the has-tostringtag package with npm by running npm install has-tostringtag. Once the package is installed, you can require it in your JavaScript file and use it as shown in the following code sample:

var hasSymbolToStringTag = require('has-tostringtag');

// to check if the environment has native Symbol.toStringTag support
if(hasSymbolToStringTag() === true) {
    // Your code here if the environment supports Symbol.toStringTag
} else {
    // Your code here if the environment does not support Symbol.toStringTag
}

// For checking the support of Symbol.toStringTag sham
var hasSymbolToStringTagKinda = require('has-tostringtag/shams');
if(hasSymbolToStringTagKinda() === true) {
    // Your code here if the environment supports a Symbol.toStringTag sham
} else {
    // Your code here if the environment does not support a Symbol.toStringTag sham
}

Please note that "has-tostringtag" provides two kinds of checks: one for the native Symbol.toStringTag support which is not poly-fillable, not forgeable, and another for Symbol.toStringTag sham that mostly follows the spec.

Where are the has-tostringtag docs?

The "has-tostringtag" documentation can be found in the README of the npm package page here. The README provides an overview of the package's purpose, an example of how to use it, and information on supported Symbol shams. It also gives a brief guide on how to launch tests if required. For more robust information regarding the JavaScript Symbol.toStringTag property, developers can refer to the ECMAScript specification as well as the comprehensive documentation provided by Mozilla Developer Network (MDN).

All Versions