Skip to content

Commit

Permalink
[Refactor] use has-symbols/shams and has-bigints to more robustly…
Browse files Browse the repository at this point in the history
… detect these things
  • Loading branch information
ljharb committed Aug 6, 2021
1 parent 04ce4d0 commit 4f3aee4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
"es-get-iterator": "^1.1.2",
"functions-have-names": "^1.2.2",
"has": "^1.0.3",
"has-bigints": "^1.0.1",
"has-symbols": "^1.0.2",
"is-arrow-function": "^2.0.3",
"is-bigint": "^1.0.2",
"is-boolean-object": "^1.1.1",
Expand All @@ -65,8 +67,6 @@
"es6-shim": "^0.35.6",
"eslint": "^7.25.0",
"foreach": "^2.0.5",
"has-bigints": "^1.0.1",
"has-symbols": "^1.0.2",
"make-arrow-function": "~1.1.0",
"nyc": "^10.3.2",
"safe-publish-latest": "^1.1.4",
Expand Down
6 changes: 4 additions & 2 deletions why.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,18 @@ var getIterator = require('es-get-iterator');
var whichCollection = require('which-collection');
var whichBoxedPrimitive = require('which-boxed-primitive');
var getPrototypeOf = require('object.getprototypeof/polyfill')();
var hasSymbols = require('has-symbols/shams')();
var hasBigInts = require('has-bigints')();

var objectType = function (v) { return whichCollection(v) || whichBoxedPrimitive(v) || typeof v; };

var isProto = Object.prototype.isPrototypeOf;

var functionsHaveNames = require('functions-have-names')();

var symbolValue = typeof Symbol === 'function' ? Symbol.prototype.valueOf : null;
var symbolValue = hasSymbols ? Symbol.prototype.valueOf : null;

var bigIntValue = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
var bigIntValue = hasBigInts ? BigInt.prototype.valueOf : null;

var normalizeFnWhitespace = function normalizeWhitespace(fnStr) {
// this is needed in IE 9, at least, which has inconsistencies here.
Expand Down

0 comments on commit 4f3aee4

Please sign in to comment.