source: imaps-frontend/node_modules/set-proto/index.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 733 bytes
Line 
1'use strict';
2
3var reflectSetProto = require('./Reflect.setPrototypeOf');
4var originalSetProto = require('./Object.setPrototypeOf');
5
6var setDunderProto = require('dunder-proto/set');
7
8var $TypeError = require('es-errors/type');
9
10/** @type {import('.')} */
11module.exports = reflectSetProto
12 ? function setProto(O, proto) {
13 // @ts-expect-error TS can't narrow inside a closure, for some reason
14 if (reflectSetProto(O, proto)) {
15 return O;
16 }
17 throw new $TypeError('Reflect.setPrototypeOf: failed to set [[Prototype]]');
18 }
19 : originalSetProto || (
20 setDunderProto ? function setProto(O, proto) {
21 // @ts-expect-error TS can't narrow inside a closure, for some reason
22 setDunderProto(O, proto);
23 return O;
24 } : null
25 );
Note: See TracBrowser for help on using the repository browser.