33 lines
1.0 KiB
JavaScript
33 lines
1.0 KiB
JavaScript
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
exports.default = function (realm) {
|
|
// ECMA262 22.1.3.30
|
|
return new _index.NativeFunctionValue(realm, "Array.prototype.toString", "toString", 0, function (context) {
|
|
// 1. Let array be ? ToObject(this value).
|
|
var array = _singletons.To.ToObjectPartial(realm, context);
|
|
|
|
// 2. Let func be ? Get(array, "join").
|
|
var func = (0, _get.Get)(realm, array, "join");
|
|
|
|
// 3. If IsCallable(func) is false, let func be the intrinsic function %ObjProto_toString%.
|
|
if (!(0, _is.IsCallable)(realm, func)) func = realm.intrinsics.ObjectProto_toString;
|
|
|
|
// 4. Return ? Call(func, array).
|
|
return (0, _call.Call)(realm, func, array);
|
|
}, false);
|
|
};
|
|
|
|
var _index = require("../../values/index.js");
|
|
|
|
var _singletons = require("../../singletons.js");
|
|
|
|
var _get = require("../../methods/get.js");
|
|
|
|
var _call = require("../../methods/call.js");
|
|
|
|
var _is = require("../../methods/is.js");
|
|
//# sourceMappingURL=ArrayProto_toString.js.map
|