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:
673 bytes
|
Rev | Line | |
---|
[79a0317] | 1 | 'use strict';
|
---|
| 2 | var $ = require('../internals/export');
|
---|
| 3 | var FREEZING = require('../internals/freezing');
|
---|
| 4 | var fails = require('../internals/fails');
|
---|
| 5 | var isObject = require('../internals/is-object');
|
---|
| 6 | var onFreeze = require('../internals/internal-metadata').onFreeze;
|
---|
| 7 |
|
---|
| 8 | // eslint-disable-next-line es/no-object-freeze -- safe
|
---|
| 9 | var $freeze = Object.freeze;
|
---|
| 10 | var FAILS_ON_PRIMITIVES = fails(function () { $freeze(1); });
|
---|
| 11 |
|
---|
| 12 | // `Object.freeze` method
|
---|
| 13 | // https://tc39.es/ecma262/#sec-object.freeze
|
---|
| 14 | $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !FREEZING }, {
|
---|
| 15 | freeze: function freeze(it) {
|
---|
| 16 | return $freeze && isObject(it) ? $freeze(onFreeze(it)) : it;
|
---|
| 17 | }
|
---|
| 18 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.