main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
533 bytes
|
Rev | Line | |
---|
[79a0317] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | var result = require('./')();
|
---|
| 4 |
|
---|
| 5 | var test = {
|
---|
| 6 | __proto__: null,
|
---|
| 7 | foo: {}
|
---|
| 8 | };
|
---|
| 9 |
|
---|
| 10 | var setter = require('dunder-proto/set');
|
---|
| 11 |
|
---|
| 12 | /** @type {import('./mutator')} */
|
---|
| 13 | module.exports = function hasMutator() {
|
---|
| 14 | if (!result) {
|
---|
| 15 | return false;
|
---|
| 16 | }
|
---|
| 17 |
|
---|
| 18 | var obj = { __proto__: test };
|
---|
| 19 | // @ts-expect-error: TS errors on an inherited property for some reason
|
---|
| 20 | if (obj.foo !== test.foo) {
|
---|
| 21 | return false;
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | if (!setter) {
|
---|
| 25 | return false;
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | setter(obj, null);
|
---|
| 29 | if ('foo' in obj || 'toString' in obj) {
|
---|
| 30 | return false;
|
---|
| 31 | }
|
---|
| 32 | return true;
|
---|
| 33 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.