|
'use strict'; |
|
|
|
var GetIntrinsic = require('get-intrinsic'); |
|
|
|
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); |
|
|
|
var hasPropertyDescriptors = function hasPropertyDescriptors() { |
|
if ($defineProperty) { |
|
try { |
|
$defineProperty({}, 'a', { value: 1 }); |
|
return true; |
|
} catch (e) { |
|
|
|
return false; |
|
} |
|
} |
|
return false; |
|
}; |
|
|
|
hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() { |
|
|
|
if (!hasPropertyDescriptors()) { |
|
return null; |
|
} |
|
try { |
|
return $defineProperty([], 'length', { value: 1 }).length !== 1; |
|
} catch (e) { |
|
|
|
return true; |
|
} |
|
}; |
|
|
|
module.exports = hasPropertyDescriptors; |
|
|