You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

has-tostringtag

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

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
37M
increased by0.67%
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

Changelog

Source

v1.0.2 - 2024-02-01

Fixed

  • [Fix] move has-symbols back to prod deps #3

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

Tests

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

Keywords

FAQs

Package last updated on 01 Feb 2024

Did you know?

Socket

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
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc