You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
407 B
12 lines
407 B
1 month ago
|
import _typeof from "./typeof.js";
|
||
|
function toPrimitive(t, r) {
|
||
|
if ("object" != _typeof(t) || !t) return t;
|
||
|
var e = t[Symbol.toPrimitive];
|
||
|
if (void 0 !== e) {
|
||
|
var i = e.call(t, r || "default");
|
||
|
if ("object" != _typeof(i)) return i;
|
||
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
||
|
}
|
||
|
return ("string" === r ? String : Number)(t);
|
||
|
}
|
||
|
export { toPrimitive as default };
|