Basic design patterns
npm install typed-patternsBasic design patterns for TypeScript.
_This project is under development and may make breaking changes in minor versions until 1.0._
``bash`
npm install typed-patterns
* Synchronous and asynchronous chain-of-responsibility. See examples in source/examples/behavioral/chain-of-responsibility
* success(callback, ...result) calls specified callback as successful with array of resultsfail(callback, error)
* calls specified callback as failed with specified errorjoin(onSuccess, onError)
* builds classical callback function from two success-callback and error-callbackwrapCallback(callback)
* builds callback function that wraps array of success results into single tupleunwrapCallback(callback)
* builds callback function that unwraps single tuple to an array of success resultswrapWorker(worker)
* builds asynchronous worker function that wraps array of results into single tupleunwrapWorker(worker)
* builds asynchronous worker function that unwraps single result to an array of resultscollect(workersCollection)
* builds asynchronous worker that collects results from all passed workersguardAsyncProcessor(guard, processor)
* builds asynchronous processor responsible only for type-guarded context
* guardPromiseProcessor(guard, processor) builds asynchronous processor responsible only for type-guarded context
* class Unexpected Base class of unexpected context exceptionunexpected(message?, callback?, next?)` Calls next (if specified) or passes Unexpected exception to callback (if specified)
*