IsExtensible.js 509 B

123456789101112131415161718
  1. 'use strict';
  2. var GetIntrinsic = require('get-intrinsic');
  3. var $preventExtensions = GetIntrinsic('%Object.preventExtensions%', true);
  4. var $isExtensible = GetIntrinsic('%Object.isExtensible%', true);
  5. var isPrimitive = require('../helpers/isPrimitive');
  6. // https://ecma-international.org/ecma-262/6.0/#sec-isextensible-o
  7. module.exports = $preventExtensions
  8. ? function IsExtensible(obj) {
  9. return !isPrimitive(obj) && $isExtensible(obj);
  10. }
  11. : function IsExtensible(obj) {
  12. return !isPrimitive(obj);
  13. };