which-typed-array
Advanced tools
Comparing version 1.1.5 to 1.1.6
@@ -10,2 +10,13 @@ # Changelog | ||
## [v1.1.6](https://github.com/inspect-js/which-typed-array/compare/v1.1.5...v1.1.6) - 2021-08-06 | ||
### Fixed | ||
- [Fix] if Symbol.toStringTag exists but is not present, use Object.prototype.toString [`#51`](https://github.com/inspect-js/which-typed-array/issues/51) [`#49`](https://github.com/inspect-js/which-typed-array/issues/49) | ||
### Commits | ||
- [Dev Deps] update `is-callable`, `tape` [`63eb1e3`](https://github.com/inspect-js/which-typed-array/commit/63eb1e3faede3f328bbbb4a5fcffc2e4769cf4ec) | ||
- [Deps] update `is-typed-array` [`c5056f0`](https://github.com/inspect-js/which-typed-array/commit/c5056f0007d4c9434f1fa69eff183109468b4769) | ||
## [v1.1.5](https://github.com/inspect-js/which-typed-array/compare/v1.1.4...v1.1.5) - 2021-08-05 | ||
@@ -12,0 +23,0 @@ |
19
index.js
@@ -20,12 +20,11 @@ 'use strict'; | ||
var arr = new global[typedArray](); | ||
if (!(Symbol.toStringTag in arr)) { | ||
throw new EvalError('this engine has support for Symbol.toStringTag, but ' + typedArray + ' does not have the property! Please report this.'); | ||
if (Symbol.toStringTag in arr) { | ||
var proto = getPrototypeOf(arr); | ||
var descriptor = gOPD(proto, Symbol.toStringTag); | ||
if (!descriptor) { | ||
var superProto = getPrototypeOf(proto); | ||
descriptor = gOPD(superProto, Symbol.toStringTag); | ||
} | ||
toStrTags[typedArray] = descriptor.get; | ||
} | ||
var proto = getPrototypeOf(arr); | ||
var descriptor = gOPD(proto, Symbol.toStringTag); | ||
if (!descriptor) { | ||
var superProto = getPrototypeOf(proto); | ||
descriptor = gOPD(superProto, Symbol.toStringTag); | ||
} | ||
toStrTags[typedArray] = descriptor.get; | ||
} | ||
@@ -54,4 +53,4 @@ }); | ||
if (!isTypedArray(value)) { return false; } | ||
if (!hasToStringTag) { return $slice($toString(value), 8, -1); } | ||
if (!hasToStringTag || !(Symbol.toStringTag in value)) { return $slice($toString(value), 8, -1); } | ||
return tryTypedArrays(value); | ||
}; |
{ | ||
"name": "which-typed-array", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"author": { | ||
@@ -64,3 +64,3 @@ "name": "Jordan Harband", | ||
"has-tostringtag": "^1.0.0", | ||
"is-typed-array": "^1.1.5" | ||
"is-typed-array": "^1.1.6" | ||
}, | ||
@@ -73,3 +73,3 @@ "devDependencies": { | ||
"in-publish": "^2.0.1", | ||
"is-callable": "^1.2.3", | ||
"is-callable": "^1.2.4", | ||
"make-arrow-function": "^1.2.0", | ||
@@ -79,3 +79,3 @@ "make-generator-function": "^2.0.0", | ||
"safe-publish-latest": "^1.1.4", | ||
"tape": "^5.3.0" | ||
"tape": "^5.3.1" | ||
}, | ||
@@ -82,0 +82,0 @@ "testling": { |
28282
134
Updatedis-typed-array@^1.1.6