0.1.4 • Published 5 years ago
@webassemb.ly/utils v0.1.4
@webassemb.ly/utils
Utility methods used in webassemb.ly.
Methods
- invariant - check that an assertion is true or raise an error message.
- testy - create a declaration and test whether one or more assertions hold true.
- iterate - evaluate an iterator through a protocol for each yielded or returned value.
Types
This repository uses the Flow type system. The following types are exposed by the utils
library.
ReturnType
- A generic type which will resolve the type returned by any function.ArgsType
- A generic type which will resolve the arguments passed to any function.PromiseResolveType
- A generic type which will resolve the value resolved by any promise.PromisesResolveType
- A generic type which will resolve the values resolved by any array of promises (such as throughPromise.all
andPromise.race
API methods ').
Types exported by testy
- DeclarationType - Defines the possible types for a
testy
declaration. - AssertionType - Defines the posible types for each
testy
assertion. - AssertionFactoryType - Defines the type for the
testy
assertion factory method.
Contributing
- One function per file.
- Use flow comment types
- Each file must have 100% flow coverage.
- Write unit tests
- Types must end with the word "Type"