1.0.0 • Published 1 year ago

@f1stnpm2/perspiciatis-aut-accusamus v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@f1stnpm2/perspiciatis-aut-accusamus

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 @f1stnpm2/perspiciatis-aut-accusamus

API

@f1stnpm2/perspiciatis-aut-accusamus.fromCallback(fn)

Takes a callback-based function to @f1stnpm2/perspiciatis-aut-accusamus, and returns the universalified function.

Function must take a callback as the last parameter that will be called with the signature (error, result). @f1stnpm2/perspiciatis-aut-accusamus 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 = @f1stnpm2/perspiciatis-aut-accusamus.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!
})

@f1stnpm2/perspiciatis-aut-accusamus.fromPromise(fn)

Takes a promise-based function to @f1stnpm2/perspiciatis-aut-accusamus, and returns the universalified function.

Function must return a valid JS promise. @f1stnpm2/perspiciatis-aut-accusamus does not ensure that a valid promise is returned.

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

const fn = @f1stnpm2/perspiciatis-aut-accusamus.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

columnprotobufperformanceiterationisConcatSpreadablebreakupArray.prototype.flatMapmkdirpfindLastreadablestablenested cssserializationquotereadposefiltertrimStartartclientdeletequeueconcurrencycurldefinePropertyttyrobusttranspiledirectoryminimalinterruptsformatfullwidthInt32ArrayprivatereadablestreamgetOwnPropertyDescriptorcreategenericschecktraverseformsmodulemkdirarrayschemefunctionsregularvaluesrm -frlazyfast-deep-cloneloadingeslintspecreal-timeshimxtermrm -rfsymlinkslook-upes8validatores5eslintconfigcallbacknativemochahttpfixed-widthregular expressionmimecorefseventsReactiveXarraystslibArray.prototype.findLastIndexSymbol.toStringTagutil.inspectArraylanguagedefinemkdirshookformdirless csseast-asian-widthdataexpressionframeworkstreams2objes-shimssymbolsequalworkerarraybufferECMAScript 7assertsrequestcompilerECMAScript 2019merge@@toStringTagclassnamestrimLeftkeysintrinsichandlersWebSocketsstatuspipeloggingconfigurableUnderscoremiddlewarewalkingreduxbluebirdparentsoutputtimeES2015wrapdom-testing-librarybootstrap csspromisetypedarraymetadatareact-hook-formwgetinternalio-tsinstallcontainsmobilepackageconcatMapmakeclifull-widthprivate dataexpresses7utilityfind-upvalidationfunctionECMAScript 3TypedArrayString.prototype.matchAlleventsfindupUint8ClampedArrayfastifyfast-copytypeerrortasknegativeonceES2023copyArray.prototype.filterless compilerduplexsetImmediatedeep-clone6to5Array.prototype.findLastjslinkstructuredCloneFunction.prototype.namegroupBystringdeepWeakSetmulti-packagefastclonesidepatchpasswordflatajaxfile system.envStyleSheetsharedwalkpicomatchpolyfillcolumnsindicatordragsuperstructdifftypedarrayswarningtapeeventEmitterclassesgdprdateajvforEachloggeroperating-systemsigtermargumentjwtjavascriptpathpoint-freepluginjestArray.prototype.flatnegative zeroyamlsymbolutilBigUint64Arraycall-bindkarmaqsnumberjson-schema-validationaccessorbundlingstreamfpserializesigintassignawaitsomeReflect.getPrototypeOfeventDispatcherArrayBuffer#slicevariables in cssencryptionharmony__proto__purestylesheetcss lessramdaanimationcomputed-typestypanionaccessibilityURLsuperagentcollectioneverygroupexit-codeECMAScript 2015fastjsonpathlimitratelimitbindcodesmomentsyntaxES2020styleguidetostringtagirqoptimizerbyteOffsetbuffersbrowserliststatelesschromePromiseregular expressionsweakmaptextoptimistredactpopmotionjapaneseprototypelistenersreact poseArrayBuffer.prototype.sliceES2018typeddayjses2017internal slotwatchspringRxprocessbyteLengthcorsbcryptlinewrapstringifierdescriptorvalueES3ecmascriptes2015positiveconstsettingshasOwnletes6toobjecttc39logcallRxJSlessfindLastIndexECMAScript 2020preserve-symlinksgetintrinsicpyyamlauthasyncparsewindowslruIteratorbatcheslintpluginlinuxshamECMAScript 6serializerfastcopyUint16ArraychinesestdlibnopeparserFloat32Arraymake dirhases256lookES8styled-componentsES2019httpscjkclonenodechromiumES2016ES7css variablebusywhichwidthObject.entriesjsonmodulestoolsquerylintTypeScripta11yflagsavaprotoslotCSSECMAScript 2017babelStreamsvariablesdomObservabletacitphonexhrworkspace:*waapipushInt16ArraytsPushdescriptiongraphqlHyBiasciitoolkitwatcherhardlinkssanitizationsanitizeredux-toolkittouchpreprocessorratesetter-0fileexitwhatwgMapjasmineform-validationterminalefficientreusestyleenvreact animationasserttoArrayxssES6SymbolArrayBufferrequireprotocol-buffersi18nvalidregexpwebmaprgbfigletObject.definePropertyimmutablereducerrapidzeroinvariantrfc4122es-shim APIAsyncIteratorinspectpropJSONcharacterauthenticationapibootstrap lessES2022Uint32ArrayES2017Array.prototype.flattenTypeBoxstringifyflattensymlinkconsoleless mixinsdropframerrecursivepropertiesECMAScript 2022nodejswatchingperformantmacoswaitresolvesyntaxerrorkeyconsumeprefixRegExp#flagssortedbrowserargparsegettertypescriptcryptchannelmonorepoponyfillpackage managerfromassertiongetpropertyless.jsimportoffsetsafeargsjsdiffcssECMAScript 2016typesafefunctionalUint8Arrayuser-streamsECMAScript 2021signalapollospinnerreact-testing-libraryObject.ispersistentelectroncompile lesses2016awesomesauceruntimeObject0iteratorcallbindreact-hooksutilsjsonschematypeECMAScript 2023visualremovehashdeepclonepostcssSetobjectrandomgradients css3toSortedpruneObject.keyscomparejsxslicemoveclassnameES2021telephoneregexrmdirStreamjoiomitcommand-lineES5eslint-pluginnpmbddformattingglobquerystringESnextWebSocketRegExp.prototype.flagsdataviewgradients csspackage.jsoncharactersclass-validatorfast-deep-copyfast-clonecss nestingboundgesturesthrottleextendCSSStyleDeclarationECMAScript 2018shellnamesvalidatel10nvarECMAScript 5throatpromisesestreebannerextraiethreecolordependency managerentriestrimRightconcatgetPrototypeOfFloat64ArrayinferenceESlengthlockfiledebuggerpostcss-pluginjsdomarktypeincludesBigInt64ArrayJSON-SchemawatchFileenumerableObject.valuesURLSearchParamsObject.assigntypeofcollection.es6rmvestimmerhigher-orderformstartertddfolderprogressidlelastinstallerwordbreakopencall-boundtrimcode pointskoreanfantasy-landtypesfindObject.getPrototypeOfguidhookstermshebangString.prototype.trimjson-schemacallboundArray.prototype.includesbabel-coresignalsObject.fromEntries[[Prototype]]environmentiterateansiurlRFC-6455sameValueZeroisparentcore-jscolorscss-in-jsrangeerrormatcheslibphonenumbertyped arrayprettyqueueMicrotaskdeep-copyspeedcircularWeakMapairbnbreducetoStringTagmatchAllsearchcurrieddeterministicconnectlesscsscensormimetypesinputdotenvdependenciessetPrototypeOffssharedarraybufferpnpm9YAMLemojiReactiveExtensionsuuid$.extendInt8Arraynameemitfetchsequenceweaksetuninstallunicodecachemime-dbexeccolourdebugbyteextensionshrinkwrapdescriptorsstreamsbundlercommandwritemrutakesortflagconfig_.extenddatastructurereactfullviewdataViewgetoptes-abstractchaistylesscheme-validationcommandertestmixinswordwraputilitiesset
1.0.0

1 year ago