Socket
Socket
Sign inDemoInstall

has-tostringtag

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    has-tostringtag

Determine if the JS environment has `Symbol.toStringTag` support. Supports spec, or shams.


Version published
Weekly downloads
36M
increased by1.98%
Maintainers
1
Install size
37.3 kB
Created
Weekly downloads
 

Package description

What is has-tostringtag?

The `has-tostringtag` npm package is designed to check if the environment has `Symbol.toStringTag` support. This is particularly useful for identifying and working with built-in object tags in a way that's consistent with the ECMAScript specification, especially in environments where this feature might not be available or fully implemented.

What are has-tostringtag's main functionalities?

Checking `Symbol.toStringTag` support

This code checks if the current environment supports `Symbol.toStringTag`. It's useful for determining if you can rely on `Symbol.toStringTag` for identifying object types.

"use strict";\nvar hasToStringTag = require('has-tostringtag');\n\nif (hasToStringTag) {\n  console.log('Environment supports Symbol.toStringTag');\n} else {\n  console.log('Environment does not support Symbol.toStringTag');\n}

Other packages similar to has-tostringtag

Readme

Source

has-tostringtag Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

Determine if the JS environment has Symbol.toStringTag support. Supports spec, or shams.

Example

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

hasSymbolToStringTag() === true; // if the environment has native Symbol.toStringTag support. Not polyfillable, not forgeable.

var hasSymbolToStringTagKinda = require('has-tostringtag/shams');
hasSymbolToStringTagKinda() === true; // if the environment has a Symbol.toStringTag sham that mostly follows the spec.

Supported Symbol shams

  • get-own-property-symbols npm | github
  • core-js npm | github

Tests

Simply clone the repo, npm install, and run npm test

Keywords

FAQs

Last updated on 01 Feb 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc