web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
495 B

  1. 'use strict';
  2. var GetIntrinsic = require('get-intrinsic');
  3. var $TypeError = GetIntrinsic('%TypeError%');
  4. var Get = require('./Get');
  5. var ToLength = require('./ToLength');
  6. var Type = require('./Type');
  7. // https://262.ecma-international.org/11.0/#sec-lengthofarraylike
  8. module.exports = function LengthOfArrayLike(obj) {
  9. if (Type(obj) !== 'Object') {
  10. throw new $TypeError('Assertion failed: `obj` must be an Object');
  11. }
  12. return ToLength(Get(obj, 'length'));
  13. };
  14. // TODO: use this all over