main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 3 months ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
543 bytes
|
Rev | Line | |
---|
[d565449] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
---|
| 4 | value: true
|
---|
| 5 | });
|
---|
| 6 | exports.default = toPrimitive;
|
---|
| 7 | function toPrimitive(input, hint) {
|
---|
| 8 | if (typeof input !== "object" || !input) return input;
|
---|
| 9 | var prim = input[Symbol.toPrimitive];
|
---|
| 10 | if (prim !== undefined) {
|
---|
| 11 | var res = prim.call(input, hint || "default");
|
---|
| 12 | if (typeof res !== "object") return res;
|
---|
| 13 | throw new TypeError("@@toPrimitive must return a primitive value.");
|
---|
| 14 | }
|
---|
| 15 | return (hint === "string" ? String : Number)(input);
|
---|
| 16 | }
|
---|
| 17 |
|
---|
| 18 | //# sourceMappingURL=toPrimitive.js.map
|
---|
Note:
See
TracBrowser
for help on using the repository browser.