GetArrayBufferMaxByteLengthOption.js 500 B

123456789101112131415161718192021
  1. 'use strict';
  2. var Get = require('./Get');
  3. var ToIndex = require('./ToIndex');
  4. var Type = require('./Type');
  5. // https://tc39.es/ecma262/#sec-getarraybuffermaxbytelengthoption
  6. module.exports = function GetArrayBufferMaxByteLengthOption(options) {
  7. if (Type(options) !== 'Object') {
  8. return 'EMPTY'; // step 1
  9. }
  10. var maxByteLength = Get(options, 'maxByteLength'); // step 2
  11. if (typeof maxByteLength === 'undefined') {
  12. return 'EMPTY'; // step 3
  13. }
  14. return ToIndex(maxByteLength); // step 4
  15. };