4d922aab6237927d491a95b7f809853d.json
5.26 KB
{"ast":null,"code":"'use strict';\n\nvar $ = require('../internals/export');\n\nvar aFunction = require('../internals/a-function');\n\nvar newPromiseCapabilityModule = require('../internals/new-promise-capability');\n\nvar perform = require('../internals/perform');\n\nvar iterate = require('../internals/iterate'); // `Promise.allSettled` method\n// https://github.com/tc39/proposal-promise-allSettled\n\n\n$({\n target: 'Promise',\n stat: true\n}, {\n allSettled: function allSettled(iterable) {\n var C = this;\n var capability = newPromiseCapabilityModule.f(C);\n var resolve = capability.resolve;\n var reject = capability.reject;\n var result = perform(function () {\n var promiseResolve = aFunction(C.resolve);\n var values = [];\n var counter = 0;\n var remaining = 1;\n iterate(iterable, function (promise) {\n var index = counter++;\n var alreadyCalled = false;\n values.push(undefined);\n remaining++;\n promiseResolve.call(C, promise).then(function (value) {\n if (alreadyCalled) return;\n alreadyCalled = true;\n values[index] = {\n status: 'fulfilled',\n value: value\n };\n --remaining || resolve(values);\n }, function (error) {\n if (alreadyCalled) return;\n alreadyCalled = true;\n values[index] = {\n status: 'rejected',\n reason: error\n };\n --remaining || resolve(values);\n });\n });\n --remaining || resolve(values);\n });\n if (result.error) reject(result.value);\n return capability.promise;\n }\n});","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/core-js-pure/modules/es.promise.all-settled.js"],"names":["$","require","aFunction","newPromiseCapabilityModule","perform","iterate","target","stat","allSettled","iterable","C","capability","f","resolve","reject","result","promiseResolve","values","counter","remaining","promise","index","alreadyCalled","push","undefined","call","then","value","status","error","reason"],"mappings":"AAAA;;AACA,IAAIA,CAAC,GAAGC,OAAO,CAAC,qBAAD,CAAf;;AACA,IAAIC,SAAS,GAAGD,OAAO,CAAC,yBAAD,CAAvB;;AACA,IAAIE,0BAA0B,GAAGF,OAAO,CAAC,qCAAD,CAAxC;;AACA,IAAIG,OAAO,GAAGH,OAAO,CAAC,sBAAD,CAArB;;AACA,IAAII,OAAO,GAAGJ,OAAO,CAAC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D,CAAN,GAAgB;AAAEO,YAAAA,MAAM,EAAE,UAAV;AAAsBE,YAAAA,MAAM,EAAED;AAA9B,WAAhB;AACA,YAAEV,SAAF,IAAeN,OAAO,CAACI,MAAD,CAAtB;AACD,SAVD;AAWD,OAhBM,CAAP;AAiBA,QAAEE,SAAF,IAAeN,OAAO,CAACI,MAAD,CAAtB;AACD,KAvBmB,CAApB;AAwBA,QAAIF,MAAM,CAACc,KAAX,EAAkBf,MAAM,CAACC,MAAM,CAACY,KAAR,CAAN;AAClB,WAAOhB,UAAU,CAACS,OAAlB;AACD;AAhCkC,CAApC,CAAD","sourcesContent":["'use strict';\nvar $ = require('../internals/export');\nvar aFunction = require('../internals/a-function');\nvar newPromiseCapabilityModule = require('../internals/new-promise-capability');\nvar perform = require('../internals/perform');\nvar iterate = require('../internals/iterate');\n\n// `Promise.allSettled` method\n// https://github.com/tc39/proposal-promise-allSettled\n$({ target: 'Promise', stat: true }, {\n allSettled: function allSettled(iterable) {\n var C = this;\n var capability = newPromiseCapabilityModule.f(C);\n var resolve = capability.resolve;\n var reject = capability.reject;\n var result = perform(function () {\n var promiseResolve = aFunction(C.resolve);\n var values = [];\n var counter = 0;\n var remaining = 1;\n iterate(iterable, function (promise) {\n var index = counter++;\n var alreadyCalled = false;\n values.push(undefined);\n remaining++;\n promiseResolve.call(C, promise).then(function (value) {\n if (alreadyCalled) return;\n alreadyCalled = true;\n values[index] = { status: 'fulfilled', value: value };\n --remaining || resolve(values);\n }, function (error) {\n if (alreadyCalled) return;\n alreadyCalled = true;\n values[index] = { status: 'rejected', reason: error };\n --remaining || resolve(values);\n });\n });\n --remaining || resolve(values);\n });\n if (result.error) reject(result.value);\n return capability.promise;\n }\n});\n"]},"metadata":{},"sourceType":"script"}