es-set-tostringtag
TypeScript icon, indicating that this package has built-in type declarations

2.0.3 • Public • Published

es-set-tostringtag Version Badge

github actions coverage License Downloads

npm badge

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

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!]');

Tests

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

Readme

Keywords

none

Package Sidebar

Install

npm i es-set-tostringtag

Weekly Downloads

24,942,672

Version

2.0.3

License

MIT

Unpacked Size

13.9 kB

Total Files

9

Last publish

Collaborators

  • ljharb