Best JavaScript code snippet using wpt
async-iterator-prototype.js
Source:async-iterator-prototype.js
1var global = require('../internals/global');2var shared = require('../internals/shared-store');3var getPrototypeOf = require('../internals/object-get-prototype-of');4var has = require('../internals/has');5var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');6var wellKnownSymbol = require('../internals/well-known-symbol');7var IS_PURE = require('../internals/is-pure');8var USE_FUNCTION_CONSTRUCTOR = 'USE_FUNCTION_CONSTRUCTOR';9var ASYNC_ITERATOR = wellKnownSymbol('asyncIterator');10var AsyncIterator = global.AsyncIterator;11var PassedAsyncIteratorPrototype = shared.AsyncIteratorPrototype;12var AsyncIteratorPrototype, prototype;13if (!IS_PURE) {14 if (PassedAsyncIteratorPrototype) {15 AsyncIteratorPrototype = PassedAsyncIteratorPrototype;16 } else if (typeof AsyncIterator == 'function') {17 AsyncIteratorPrototype = AsyncIterator.prototype;18 } else if (shared[USE_FUNCTION_CONSTRUCTOR] || global[USE_FUNCTION_CONSTRUCTOR]) {19 try {20 // eslint-disable-next-line no-new-func21 prototype = getPrototypeOf(getPrototypeOf(getPrototypeOf(Function('return async function*(){}()')())));22 if (getPrototypeOf(prototype) === Object.prototype) AsyncIteratorPrototype = prototype;23 } catch (error) { /* empty */ }24 }25}26if (!AsyncIteratorPrototype) AsyncIteratorPrototype = {};27if (!has(AsyncIteratorPrototype, ASYNC_ITERATOR)) {28 createNonEnumerableProperty(AsyncIteratorPrototype, ASYNC_ITERATOR, function () {29 return this;30 });31}...
esnext.async-iterator.constructor.js
Source:esnext.async-iterator.constructor.js
1'use strict';2// https://github.com/tc39/proposal-iterator-helpers3var $ = require('../internals/export');4var anInstance = require('../internals/an-instance');5var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');6var has = require('../internals/has');7var wellKnownSymbol = require('../internals/well-known-symbol');8var AsyncIteratorPrototype = require('../internals/async-iterator-prototype');9var IS_PURE = require('../internals/is-pure');10var TO_STRING_TAG = wellKnownSymbol('toStringTag');11var AsyncIteratorConstructor = function AsyncIterator() {12 anInstance(this, AsyncIteratorConstructor);13};14AsyncIteratorConstructor.prototype = AsyncIteratorPrototype;15if (!has(AsyncIteratorPrototype, TO_STRING_TAG)) {16 createNonEnumerableProperty(AsyncIteratorPrototype, TO_STRING_TAG, 'AsyncIterator');17}18if (!has(AsyncIteratorPrototype, 'constructor') || AsyncIteratorPrototype.constructor === Object) {19 createNonEnumerableProperty(AsyncIteratorPrototype, 'constructor', AsyncIteratorConstructor);20}21$({ global: true, forced: IS_PURE }, {22 AsyncIterator: AsyncIteratorConstructor...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!