1.1.5 • Published 6 days ago

@teamteanpm2024/accusantium-libero-eaque v1.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
6 days ago

@teamteanpm2024/accusantium-libero-eaque

GitHub Workflow Status (branch) Coveralls github branch npm npm

Make a callback- or promise-based function support both promises and callbacks.

Uses the native promise implementation.

Installation

npm install @teamteanpm2024/accusantium-libero-eaque

API

@teamteanpm2024/accusantium-libero-eaque.fromCallback(fn)

Takes a callback-based function to @teamteanpm2024/accusantium-libero-eaque, and returns the universalified function.

Function must take a callback as the last parameter that will be called with the signature (error, result). @teamteanpm2024/accusantium-libero-eaque does not support calling the callback with three or more arguments, and does not ensure that the callback is only called once.

function callbackFn (n, cb) {
  setTimeout(() => cb(null, n), 15)
}

const fn = @teamteanpm2024/accusantium-libero-eaque.fromCallback(callbackFn)

// Works with Promises:
fn('Hello World!')
.then(result => console.log(result)) // -> Hello World!
.catch(error => console.error(error))

// Works with Callbacks:
fn('Hi!', (error, result) => {
  if (error) return console.error(error)
  console.log(result)
  // -> Hi!
})

@teamteanpm2024/accusantium-libero-eaque.fromPromise(fn)

Takes a promise-based function to @teamteanpm2024/accusantium-libero-eaque, and returns the universalified function.

Function must return a valid JS promise. @teamteanpm2024/accusantium-libero-eaque does not ensure that a valid promise is returned.

function promiseFn (n) {
  return new Promise(resolve => {
    setTimeout(() => resolve(n), 15)
  })
}

const fn = @teamteanpm2024/accusantium-libero-eaque.fromPromise(promiseFn)

// Works with Promises:
fn('Hello World!')
.then(result => console.log(result)) // -> Hello World!
.catch(error => console.error(error))

// Works with Callbacks:
fn('Hi!', (error, result) => {
  if (error) return console.error(error)
  console.log(result)
  // -> Hi!
})

License

MIT

jsgetteranimationqsbabel-corecode pointsArrayFloat64ArrayterminalES2015lru_.extenddateparentsome@@toStringTagclass-validatormoduleses8mapreduceharmonyvaluepolyfillESnextweaksettraverseBigInt64Arrayoptimizertelephonepicomatchec2Underscorecall-bindprefixemitbrowserlistformattingAsyncIteratorbddPushtypeoffile systemposejson-schema-validationpipestatusargsexpressionES3-0ajvlistenersFunction.prototype.namedefinePropertynativezoddiffvaluesbalancedregular expressionsinvariantfaststyleguidestreams2typeguiddefineshameventDispatchererror-handlingprogressreuseless.jsmacospyyamlreact-testing-libraryfastclonebytelazyfixed-widthsigtermkeysavacolumnvariables in css256artcryptoextendTypedArrayfputilwaitfindprivate datadebuggeres2017emrsymbolclimomentponyfillscheme-validationtrimStartObject.keysspinnersarktypemake dirECMAScript 2023censorgetassertscallbindnested css3dcolourpropmkdirstapeprotocol-bufferszerocolorjson-schemaprivatejoiCSSargvratelimitgesturesrapidjasminefunctionbyteLengthxssfull-widthentriesproxybufferssnsdatacommand-linelook-upimmutabledom-testing-libraryopenWebSocketreact-hook-formsearchtaskdeepcopyargparsedeleteES8walkingtranspiletestercorsgdprmocha6to5visuales-shim APIbabelsyntaxregulartypedlibphonenumbernumbergetoptprotoinstallpackage.jsonswfshimcloudwatchoffsettacitasyncArrayBuffershebangdragrm -frString.prototype.trimconsoleomitchromeECMAScript 2021positivecallboundurlpasswordstringifierstringifyencryptionwalkinternal slotloggerelbArray.prototype.flatMapRegExp.prototype.flagsspinnerdayjsreduxjsonpathgetintrinsicRFC-6455dropgroupredux-toolkitpurehookformsortedfastcopyInt32Arrayrmdirdeep-copywritableargumentloadingoutputhigher-orderstableES6watchFilefromiteratorworkspace:*typedarrayECMAScript 2018makeObservablesfastifyestreefseventsCSSStyleDeclarationstylesschemettysymlinksclasseswarningObject.entriesStreamsclassnamessetImmediatelogmobiletakesharedlimitkarmapostcsscss variablefindupstringinferenceStreaminspectreact poseenderbatchfindLastIndexauthenticationpromisescreatequotebreaktapemojitrimLeftsafechannelqueueMicrotaskfind-upuser-streamsagentforEachbrowserpnpm9WeakMapeslinthases2018mapES7es-abstractprocesscodesreadablestreamkeyArray.prototype.flattenpoint-freeiterationstreamviewcollectionajaxwgetcall-boundJSONshellmiddlewaresymbolssetES2017prettyyamlcompilerdataViewvalidatorruntimeequaleslintpluginglobES2020promisesanitizebyteOffsetmonoreposetterES2021getPrototypeOfless compilertestingsuperagentgradients css3functionsES2022linkcloudformationapirgbobjfetchhardlinksoptionpreprocessorisflattentypeerrorfscopysetPrototypeOfmatchesdeterministiccommanderReflect.getPrototypeOfcallerrorrfc4122irqkoreancollection.es6parserfantasy-landuninstalldescriptorsstructuredClonel10nURLSearchParamsmatchAllloadbalancingtoArrayexit-coderequesthashtoStringTag
1.1.5

6 days ago

1.1.4

7 days ago

1.1.3

8 days ago

1.1.2

9 days ago

1.0.2

10 days ago

1.0.1

11 days ago

1.0.0

11 days ago