prepack
Version:
Execute a JS bundle, serialize global state and side effects to a snapshot that can be quickly restored.
29 lines (24 loc) • 1.06 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (realm) {
// ECMA262 18.2.6.2
let name = "decodeURI";
return new _index.NativeFunctionValue(realm, name, name, 1, (context, [encodedURI], argCount, NewTarget) => {
if (NewTarget) throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError, `${name} is not a constructor`);
encodedURI = encodedURI.throwIfNotConcrete();
// 1. Let uriString be ? ToString(encodedURI).
let uriString = _singletons.To.ToString(realm, encodedURI);
// 2. Let reservedURISet be a String containing one instance of each code unit valid in uriReserved plus "#".
// 3. Return ? Decode(uriString, reservedURISet).
try {
return new _index.StringValue(realm, decodeURI(uriString));
} catch (e) {
throw realm.createErrorThrowCompletion(realm.intrinsics.URIError, e.message);
}
});
};
var _index = require("../../values/index.js");
var _singletons = require("../../singletons.js");
//# sourceMappingURL=decodeURI.js.map