IsExtensible.js 504 B

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