main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
407 bytes
|
Line | |
---|
1 | import _typeof from "./typeof.js";
|
---|
2 | function toPrimitive(t, r) {
|
---|
3 | if ("object" != _typeof(t) || !t) return t;
|
---|
4 | var e = t[Symbol.toPrimitive];
|
---|
5 | if (void 0 !== e) {
|
---|
6 | var i = e.call(t, r || "default");
|
---|
7 | if ("object" != _typeof(i)) return i;
|
---|
8 | throw new TypeError("@@toPrimitive must return a primitive value.");
|
---|
9 | }
|
---|
10 | return ("string" === r ? String : Number)(t);
|
---|
11 | }
|
---|
12 | export { toPrimitive as default }; |
---|
Note:
See
TracBrowser
for help on using the repository browser.