es-set-tostringtag

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

Keywords

none

Install

npm i es-set-tostringtag

DownloadsWeekly Downloads

9,553,584

Version

2.0.1

License

MIT

Unpacked Size

8.91 kB

Total Files

7

Last publish

Collaborators

  • ljharb