Skip to content

Commit

Permalink
[Refactor] use call-bind instead of function-bind
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Apr 25, 2022
1 parent e6420b9 commit 0a609f1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
'use strict';

var whichBoxedPrimitive = require('which-boxed-primitive');
var bind = require('function-bind');
var callBound = require('call-bind/callBound');
var hasSymbols = require('has-symbols')();
var hasBigInts = require('has-bigints')();

var stringToString = bind.call(Function.call, String.prototype.toString);
var numberValueOf = bind.call(Function.call, Number.prototype.valueOf);
var booleanValueOf = bind.call(Function.call, Boolean.prototype.valueOf);
var symbolValueOf = hasSymbols && bind.call(Function.call, Symbol.prototype.valueOf);
var bigIntValueOf = hasBigInts && bind.call(Function.call, BigInt.prototype.valueOf);
var stringToString = callBound('String.prototype.toString');
var numberValueOf = callBound('Number.prototype.valueOf');
var booleanValueOf = callBound('Boolean.prototype.valueOf');
var symbolValueOf = hasSymbols && callBound('Symbol.prototype.valueOf');
var bigIntValueOf = hasBigInts && callBound('BigInt.prototype.valueOf');

module.exports = function unboxPrimitive(value) {
var which = whichBoxedPrimitive(value);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"tape": "^5.3.2"
},
"dependencies": {
"function-bind": "^1.1.1",
"call-bind": "^1.0.2",
"has-bigints": "^1.0.1",
"has-symbols": "^1.0.2",
"which-boxed-primitive": "^1.0.2"
Expand Down

0 comments on commit 0a609f1

Please sign in to comment.