@jsfx/utils

0.1.12 • Public • Published

@jsfx/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 through Promise.all and Promise.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", Iterfaces with "Interface"

Readme

Keywords

none

Package Sidebar

Install

npm i @jsfx/utils

Weekly Downloads

3

Version

0.1.12

License

MIT

Unpacked Size

13.4 kB

Total Files

16

Last publish

Collaborators

  • hansoksendahl