From d973ffd2268e10c0e2cd4f0c57ecf8ce0a8d8578 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Thu, 5 Aug 2021 17:18:49 -0700 Subject: [PATCH 1/3] [Refactor] use `has-tostringtag` to behave correctly in the presence of symbol shams See https://github.com/inspect-js/is-date-object/issues/22 --- index.js | 2 +- package.json | 3 +++ test/index.js | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 5f77f03..f44f7bb 100644 --- a/index.js +++ b/index.js @@ -11,7 +11,7 @@ var tryStringObject = function tryStringObject(value) { }; var toStr = Object.prototype.toString; var strClass = '[object String]'; -var hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag; +var hasToStringTag = require('has-tostringtag/shams')(); module.exports = function isString(value) { if (typeof value === 'string') { diff --git a/package.json b/package.json index ecb7855..d90515e 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,9 @@ "@@toStringTag", "String object" ], + "dependencies": { + "has-tostringtag": "^1.0.0" + }, "devDependencies": { "@ljharb/eslint-config": "^17.6.0", "aud": "^1.1.5", diff --git a/test/index.js b/test/index.js index 8fbba42..5239dfa 100644 --- a/test/index.js +++ b/test/index.js @@ -2,7 +2,7 @@ var test = require('tape'); var isString = require('../'); -var hasSymbols = typeof Symbol === 'function' && typeof Symbol.iterator !== 'undefined'; +var hasToStringTag = require('has-tostringtag/shams')(); test('not Strings', function (t) { t.notOk(isString(), 'undefined is not String'); @@ -22,7 +22,7 @@ test('not Strings', function (t) { t.end(); }); -test('@@toStringTag', { skip: !hasSymbols || !Symbol.toStringTag }, function (t) { +test('@@toStringTag', { skip: !hasToStringTag }, function (t) { var fakeString = { toString: function () { return '7'; }, valueOf: function () { return '42'; } From 4bfaabf877e874ca21d2c44be26f13add8ee2761 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Thu, 5 Aug 2021 17:44:35 -0700 Subject: [PATCH 2/3] [Dev Deps] update `auto-changelog`, `core-js`, `eslint`, `tape` --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index d90515e..0335bdf 100644 --- a/package.json +++ b/package.json @@ -39,16 +39,16 @@ "devDependencies": { "@ljharb/eslint-config": "^17.6.0", "aud": "^1.1.5", - "auto-changelog": "^2.2.1", - "core-js": "^3.12.0", + "auto-changelog": "^2.3.0", + "core-js": "^3.16.0", "eclint": "^2.8.1", - "eslint": "^7.26.0", + "eslint": "^7.32.0", "foreach": "^2.0.5", "indexof": "^0.0.1", "is": "^3.3.0", "nyc": "^10.3.2", "safe-publish-latest": "^1.1.4", - "tape": "^5.2.2" + "tape": "^5.3.0" }, "testling": { "files": "test/index.js", From e8a5b6d659f59e744ae03b2557e0482cd69194b3 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Thu, 5 Aug 2021 18:02:19 -0700 Subject: [PATCH 3/3] v1.0.7 --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9334c53..6f62043 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +## [v1.0.7](https://github.com/inspect-js/is-string/compare/v1.0.6...v1.0.7) - 2021-08-05 + +### Commits + +- [Refactor] use `has-tostringtag` to behave correctly in the presence of symbol shams [`d973ffd`](https://github.com/inspect-js/is-string/commit/d973ffd2268e10c0e2cd4f0c57ecf8ce0a8d8578) +- [Dev Deps] update `auto-changelog`, `core-js`, `eslint`, `tape` [`4bfaabf`](https://github.com/inspect-js/is-string/commit/4bfaabf877e874ca21d2c44be26f13add8ee2761) + ## [v1.0.6](https://github.com/inspect-js/is-string/compare/v1.0.5...v1.0.6) - 2021-05-07 ### Commits diff --git a/package.json b/package.json index 0335bdf..9b36548 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "is-string", - "version": "1.0.6", + "version": "1.0.7", "author": "Jordan Harband ", "funding": { "url": "https://github.com/sponsors/ljharb"