esnext.array.from-async.js 631 B

123456789101112131415161718192021
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var fromAsync = require('../internals/array-from-async');
  4. var fails = require('../internals/fails');
  5. var nativeFromAsync = Array.fromAsync;
  6. // https://bugs.webkit.org/show_bug.cgi?id=271703
  7. var INCORRECT_CONSTRUCTURING = !nativeFromAsync || fails(function () {
  8. var counter = 0;
  9. nativeFromAsync.call(function () {
  10. counter++;
  11. return [];
  12. }, { length: 0 });
  13. return counter !== 1;
  14. });
  15. // `Array.fromAsync` method
  16. // https://github.com/tc39/proposal-array-from-async
  17. $({ target: 'Array', stat: true, forced: INCORRECT_CONSTRUCTURING }, {
  18. fromAsync: fromAsync
  19. });