🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

es-set-tostringtag

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es-set-tostringtag

A helper to optimistically set Symbol.toStringTag, when possible.

2.1.0
latest
Source
npm
Version published
Weekly downloads
50M
-7.13%
Maintainers
0
Weekly downloads
 
Created
Source

es-set-tostringtag Version Badge

github actions coverage License Downloads

npm badge

A helper to optimistically set Symbol.toStringTag, when possible.

Example

Most common usage:

var assert = require('assert');
var setToStringTag = require('es-set-tostringtag');

var obj = {};

assert.equal(Object.prototype.toString.call(obj), '[object Object]');

setToStringTag(obj, 'tagged!');

assert.equal(Object.prototype.toString.call(obj), '[object tagged!]');

Options

An optional options argument can be provided as the third argument. The available options are:

force

If the force option is set to true, the toStringTag will be set even if it is already set.

nonConfigurable

If the nonConfigurable option is set to true, the toStringTag will be defined as non-configurable when possible.

Tests

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

FAQs

Package last updated on 02 Jan 2025

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