pareto-api v11.0.1
pareto-api
this package defines the API for the pareto package (https://github.com/corno/pareto) This package can be included in packages that only define API's and that want to use the pareto style of programming
pareto has the following interfaces:
ValueValue is a promise like interface
it supports the following method:
handlethere are 2 flavors:
IValueandIUnsafeValue.The unsafe value has a possible error state (which is similar to the native
Promiseclass, but where the error is typesafe).The safe value does not have an error state
Lookupsupports the following method:
getEntrythere are 2 flavors:
SaveandUnsave: An unsafe lookup can give a custom error when the getEntry method is called. This is useful when the Lookup is not guaranteed to be always available
Dictionaryextends
Lookup, supports the following additional methodscreateEntrydeleteEntryrenameEntrycopyEntrygetKeysthere are 2 additional flavors;
LoosevsStrict, leading to 4 alternatives:ISafeLooseDictionaryIUnsafeLooseDictionaryISafeStrictDictionaryIUnsafeStrictDictionaryLoose/Strict: Stict means that the provider is guaranteed to implement all methods. Loose means that the provider is not guaranteed to implement all methods
Resourcea Resource is an interface that can be opened (giving access to the content), and must be closed afterwards.
there are
OpenableandOpenedinterfaces, both in 2 flavors:SafeandUnsafeOpenableinterfaces have a method calledopengiving access to theOpenedintefaceOpenedinterfaces have a method calledcloseand a member calledcontentSafevsUnsafeindicates wether theopenorclosemethod can result in an error
Stream
a Stream is an interface that has a method called
handleto which aStreamConsumermust be provided. The StreamConsumer must implement a method calledonDataand a method calledonEnd. The stream is callingonDatazero or more times until the end of the stream is reached and thenonEndis called.There is a specialization of the
Streaminterface calledKeyValueStreamwhich enforces that the data are key/value pairs
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago