1.0.0 • Published 1 year ago

@ryniaubenpm2/accusantium-dolorum-earum v1.0.0

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

@ryniaubenpm2/accusantium-dolorum-earum

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 @ryniaubenpm2/accusantium-dolorum-earum

API

@ryniaubenpm2/accusantium-dolorum-earum.fromCallback(fn)

Takes a callback-based function to @ryniaubenpm2/accusantium-dolorum-earum, and returns the universalified function.

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

@ryniaubenpm2/accusantium-dolorum-earum.fromPromise(fn)

Takes a promise-based function to @ryniaubenpm2/accusantium-dolorum-earum, and returns the universalified function.

Function must return a valid JS promise. @ryniaubenpm2/accusantium-dolorum-earum does not ensure that a valid promise is returned.

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

const fn = @ryniaubenpm2/accusantium-dolorum-earum.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

TypeScriptsyntaxerrorec2sortreducercallinterruptsglacierbreaktapes7functionalbootstrap csscloudtrailreal-timelanguageprettybyteLengthinstallerform-validationwritableaccessibilityimmerargvframeworktypedarraymime-dbES2017jQueryregulartypedeepECMAScript 2015eslint-plugincallbounddeletecolorssignalremovecacheReflect.getPrototypeOfmimerequirepreprocessorperformantsyntaxObject.keysexitelmextendmimetypesObservableRegExp.prototype.flagscreatereplayextraES2021errorsetPrototypeOfhandlersstringifylook-upcode pointsenumerablehardlinksescapeprototypegetOwnPropertyDescriptorgetintrinsicwatcherbufferRFC-6455sigtermvariablescall-boundestreefunctioncomparestylekeysflatMapemojimoduleshigher-ordercompilertimeauthenticationequaltoStringTagslottouchendpointzodroutingoffsetprivate dataregexEStostringtagstoragegatewayrm -frpostcss-pluginstatusincludeswordbreaktscall-bindpromisesFloat64Arraymergeconsumeless compilertrimStarti18nawsassignformattingmacoseventsoptimistlimitinstalltyped arraytelephoneinvariantInt16ArraydiffstringproxyES6koreanmomentshrinkwrapargsgenericsinferencepassworddefinewafprogressttyphonesuperstructUint32ArraybindebsstylingpluginpyyamldataviewdataViewapidefinePropertyclassnamesstylesObject.fromEntriescorsReactiveExtensionsreduxboundshamnumberrgbprivateopentslibagentdependenciesSymbol.toStringTagJSON-SchemacommanderlintrouteES2022redux-toolkitjwtdom-testing-librarycircularregular expressionbrowserslistimportexportes-shim APIObject.getPrototypeOfes2016weakmapArrayBufferspecurlnativebannerawesomesaucenpmmatchsqslivelazycollectionUint8ArrayECMAScript 2023routerclassnamewordwraputil.inspecttoolsRxJSstreamcss variabletrimEndencryptionfind-uputilitiesPushgradients css3fastclonedatecolorhashcommand-linecloneownjsonRegExp#flagsnopecharacterstypeofsymlinkslookflagjswindowsES2016readmake dirES8Promiseinternaljasminextermratelimitjapaneseasciibuffersastamazonsnsspeedloggerchaicsscss nestingobjreusemruautoscalingnested csshasOwneslintconfigtoArrayeslintjavascriptstyled-componentscompile lessiscolumnoptimizermatchesUnderscoreargumentvpcdescriptionserializationeveryAsyncIteratorsesless.jsreadablebddsettermkdirpinreactECMAScript 2022predictablesetImmediatefastcopytesterfinddatachromiumpreserve-symlinksviewarraybuffer@@toStringTaglengthjsxqueueMicrotaskes-shimsmulti-packageArray.prototype.flatMaplruelectronlinewrapvalidformscloudwatchrdstestingArray.prototype.filterfast-copyrmdirfast-cloneiamsliceObject.isstatelessIteratorrm -rfdeepcopyarrayszeroCSScharacteres8extensionmapconcurrencyawaittoobjectgradients css__proto__setdropguidfastrapidmkdirshelpersArraywgetemrchinesecolumns256ES2015fpssearchgetECMAScript 2016es2015modulestreams2monorepohttpsYAMLhttpentriesrandomtddReactiveXcallbindtypanionequalitygettertapemixinsjsdiffstylesheetpackagestarterutilityhookformparentcorebeanstalkregexppackagesraterecursiveconnectdatastructureBigInt64Arraya11yWebSocketArray.prototype.findLastIndexvariables in cssaccessorstdlibchromecommandbrowserlistdynamodbclassesdebuggerswfeslintplugintoolkitchannelstringifiertrimRightweaksetArray.prototype.findLastquerystringindicatorECMAScript 3regular expressionsless csslibphonenumberassertionES2018coercibletypedarraysURLSearchParamsStreamsTypeBoxdescriptorsWebSocketsfsfseventsauthgetPrototypeOfiterationECMAScript 2020superagentmatchAllhassigintObject.definePropertytermyamlbundlertypedglobappArrayBuffer.prototype.sliceimportartserializeString.prototype.matchAllfullwidthqueueidlefixed-widthformArray.prototype.containstraversecurles2017internal slotES2020querypolyfillpropertiesinputtc39pnpm9metadatainspectStreamdeep-cloneArray.prototype.includesruntimejsdomprotobufprotoRxcss lessObject.valuesrestmakepathES5exit-codetextxhrgroupBysharedarraybuffercryptohas-ownbluebirdbrowserFunction.prototype.namegetoptconcatMapclass-validator[[Prototype]]processlinuxJSONqsHyBieventDispatchercloudsearchdeterministicECMAScript 2018bundlingajaxCSSStyleDeclarationsafeuninstallfromoptionlogES7joiredactpersistentmobileeast-asian-widthgroupshims3fast-deep-copysameValueZerobatchargparseString.prototype.trimpipeduplexMicrosoftscheme-validationconfigspinnersio-tscliESnextparentsreact-testing-libraryspinnerdirectorykinesisSymbollockfileformatbootstrap lessreact-hooksbyteOffsetcss-in-jsfastifyfindLastmoveflatECMAScript 5react-hook-formcomputed-typesexecdomcloudformationnametoSortedresolveefficientwatchingworkspace:*ObjectenvlimitedponyfillnodejsrobusthooksworkflowcheckUint16Arraywalkdebugpatchansimkdirschemavalidationunicodefilelinkprefixstablekeytypesafeobjectes6arktypebytecontainsstatehasOwnProperty-0ArrayBuffer#slice$.extendgdprwaitreducevalues0upeswarningtrimautoprefixer_.extend.envTypedArrayrequestES3configurableassertswrapObservablesavaiteratebcryptworkerthroatparsingimmutablees-abstractrestfulcallbackconsolewatchFileWeakSetInt32ArrayfilterECMAScript 7ES2019typeerrorelbstreamstakeArray.prototype.flattenfluxmochacryptloadbalancingpackage.jsonoutputoperating-systemomitsignalsshebangtrimLeftfetchrfc4122WeakMapserializerairbnb
1.0.0

1 year ago