npm.io
1.0.0 • Published 2 years ago

@emiplegiaqmnpm/magni-doloremque-facilis

Licence
MIT
Version
1.0.0
Deps
7
Size
16 kB
Vulns
0
Weekly
0

@emiplegiaqmnpm/magni-doloremque-facilis Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

ES Proposal spec-compliant shim for Promise.prototype.finally. Invoke its "shim" method to shim Promise.prototype.finally if it is unavailable or noncompliant. Note: a global Promise must already exist: the es6-shim is recommended.

This package implements the es-shim API interface. It works in an ES3-supported environment that has Promise available globally, and complies with the proposed spec.

Most common usage:

var assert = require('assert');
var promiseFinally = require('@emiplegiaqmnpm/magni-doloremque-facilis');

var resolved = Promise.resolve(42);
var rejected = Promise.reject(-1);

promiseFinally(resolved, function () {
	assert.equal(arguments.length, 0);

	return Promise.resolve(true);
}).then(function (x) {
	assert.equal(x, 42);
});

promiseFinally(rejected, function () {
	assert.equal(arguments.length, 0);
}).catch(function (e) {
	assert.equal(e, -1);
});

promiseFinally(rejected, function () {
	assert.equal(arguments.length, 0);

	throw false;
}).catch(function (e) {
	assert.equal(e, false);
});

promiseFinally.shim(); // will be a no-op if not needed

resolved.finally(function () {
	assert.equal(arguments.length, 0);

	return Promise.resolve(true);
}).then(function (x) {
	assert.equal(x, 42);
});

rejected.finally(function () {
	assert.equal(arguments.length, 0);
}).catch(function (e) {
	assert.equal(e, -1);
});

rejected.finally(function () {
	assert.equal(arguments.length, 0);

	throw false;
}).catch(function (e) {
	assert.equal(e, false);
});

Tests

Simply clone the repo, npm install, and run npm test

Thanks

Huge thanks go out to @matthew-andrews, who provided the npm package name for v2 of this module. v1 is both in the original repo and preserved in a branch

Keywords

collection.es6point-freetacitfastclonedatalengthtypedarrayReactiveXes8equalitygenericssetterenderES2017ES2018openerpathreact-testing-library[[Prototype]]termonceconcatscheme-validationinvariantnativemime-dbnegativeuser-streamssameValueZeroECMAScript 3jestmimetypesES2021classnameRegExp.prototype.flagstslibtoolkitautoprefixerfetchcmdhardlinksrandomsliceECMAScript 7helperswgetUint32Arrayconsolestreamlimitedasttimedom-testing-libraryECMAScript 2017graphqlbluebirdramdaECMAScript 2022lastimmutablecurriedWebSocketsArray.prototype.findLastcommand-lineutilitiesnumbercensorpicomatchshrinkwrappasswordkeyregular expressionsperformancetestObject.values0boundindicatorzodECMAScript 2018error-handlingdeepclonedeepargstraverseawesomesauceArrayBuffer$.extendcss nestingconfigurableimmernamepolyfilljwtbrowserlistforEachcharacterqueueMicrotaskstarterWebSocketpositiveES6stylefast-copypureestypedarraysratelimitcurldefineworkspace:*Array.prototype.flatfileclassnamesfpexecutableregularconnecthasspawnfull-widthfindupeslintreadableloadingfromcorsgetternopewarningcontainsexectoArrayes6Observablecompilerbootstrap lessmergedotenvpromisesserializationsuperagentcallbindzeroRegExp#flagsmkdirpchineseeveryredactArray.prototype.containsjoitypewebjson-schemautilauthenticationwatcherunicodejQuerysidewaitentriescallbacktrimStart-0negative zeroSymbol.toStringTagyuptouchvalidatetostringtaggroupArray.prototype.includesmapPushObject.fromEntriesoffsetECMAScript 6writabletoStringTaggetintrinsicjavascriptsignalspluginES2019dayjsa11ypropertytyped arraytoolsquerystringwaapiformattingcallboundarraybufferstringhttpArray.prototype.flatMapslotnameslaunchmakeexit-codejsonschemaobjectECMAScript 2019formvar3dCSStranspilerprocessless mixinsdebugpostcssES2016ObjectprefixapiES2020bootstrap cssarrayurlstreams2@@toStringTagwatchrequireexpressionIteratormkdircolorscryptoWeakSetdatewriteieasyncpackagetoobjectregexptakepipeES2022fantasy-landdependency managermrubddsymbolssearchArray.prototype.flattenregexbyteOffsetreusephonetaskfunctional6to5findwhichObject.assignomitrgbes2016commandreactsanitizeawaitRxJSformatlibphonenumberpruneintrinsicmkdirsinferenceArray.prototype.findLastIndexopenAsyncIteratorbuffercoreglobargumentECMAScript 2015rm -frequalxssshamparentsTypeBoxcreateES8es2017eslintpluginwalkingeventsInt8ArrayflagsapptelephonejsdomInt16Arrayinputformsjsxprivate dataStyleSheetyamlmatchesreact animationoptimistmetadatalazysharedrecursivetrimclikarmapropsignaliteratorfast-clonestatelessstreamsObject.entriesJSONaccessibilitycollectionvaluedeepcopyansithreeMaplesscssdefaultflagESnexturlscolumnsmoveuuidairbnbtypesafeinternalkeysString.prototype.trimFloat32ArrayajaxstartfulllinttypeerrorconcurrencyshimisConcatSpreadableassertscryptwordwrapinstallhashassertweakmapObject.isArrayURLSearchParamsmake dirschemetc39xhrcolorarraysdatastructuregdprupinternal slotHyBiECMAScript 5lrustylingfast-deep-copyartgesturesenumerableeditorfunctiones2015react-hook-formmobilepackage.jsonfile systemtrimRightletbundlergradients css3clientES7iswrapcss-in-jsprivateJSON-Schemanested cssECMAScript 2016shelldependenciesmodulesstableutilsvalidationPromiseYAMLenvironmentbcrypttextstyled-componentsdescriptorcodesframermixinsquotereducerlimitES3somewatchingreduxES2015eventEmitterFloat64Arraysortreact-hookslanguageparentsigtermeslintconfigsetPrototypeOffigletrobustqueueio-tsextendsettingsconcatMapcss variableshebangdirectoryguidschemaminimalcss lessconsumeless csspostcss-pluginrangeerrorjson-schema-validationpnpm9core-jseslint-pluginmonorepoArrayBuffer.prototype.slicerfc4122cachepackagesstylesxdg-openuninstallpersistentsigintlookefficientanimationecmascriptfullwidthutilitybatchdeletedifftypanionkoreanhasOwnsequencewhatwglinuxcharactershookformESasciirmweaksetpushform-validationmatchwidthbabel-corevesthooksprototypeelectronvaluesfunctionsapolloObject.keyslistenersserializereact poseUint8ClampedArrayfastifytapeparseloggingconstES2023outputprettyencryptionnpmiterateremovextermprogress__proto__fastcopyspinnerpreserve-symlinkscolumn_.extendparserobjfindLastargumentscoercibleUnderscorebundlingECMAScript 2023harmonymiddlewarespinnersjsonincludesspecclonerm -rfcolourReflect.getPrototypeOfjsonpathsymboloptimizertddlinewrapquerytypeofdeterministicreduceinstallerSymboles7debuggerregular expressionsharedarraybufferObject.getPrototypeOfwordbreakcheckchromepropertiesbabel256sanitizationtestingqsdirUint16ArraystructuredCloneECMAScript 2021posejson-schema-validatores-abstractredux-toolkittranspileidfilterstringifierreal-timeargparseassigndeep-copyerrornodepyyamles-shim APIenvvisualvariables in csscommanderless.jssyntaxerrorclassespopmotiondefinePropertyStreamsemitbannercompareObservablescopyfixed-widthbrowserdataviewes5folder.envtypedduplexbusyprotobufgetraterequestmoduleinspectBigInt64ArraywatchFileviewreadablestreamSetjsdescriptorshigher-orderl10nidleflatstatuscall-boundInt32ArrayTypedArraywebsite