GetArrayBufferMaxByteLengthOption.js 526 B

12345678910111213141516171819202122
  1. 'use strict';
  2. var Get = require('./Get');
  3. var ToIndex = require('./ToIndex');
  4. var isObject = require('../helpers/isObject');
  5. // https://262.ecma-international.org/15.0/#sec-getarraybuffermaxbytelengthoption
  6. module.exports = function GetArrayBufferMaxByteLengthOption(options) {
  7. if (!isObject(options)) {
  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. };