@tdallau/helpers
TypeScript icon, indicating that this package has built-in type declarations

0.0.26 • Public • Published

This package contains some helper functions i use in many project. Some examples are:

  const isNum1 = isNumber(3);
  const isNum2 = isStringNumber('3');

  // creating a Option<string> instance from package @tdallau/types
  const some = some<string>('value');
  const none = none<string>();

 // creating a Either<string, number> instance from package @tdallau/types
  const left = leftEither<string, number>('value');
  const right = rightEither<string, number>('value');

  // using Func<string> from package @tdallau/types to create a promise<string>
  const p = promisify<string>((resolve, reject) => {
    if (1 == 1) {
      resolve('equil!!');
      return;
    }
    reject('somthing went wrong!!')
  })

  await timer(2000 /* ms */);

Package Sidebar

Install

npm i @tdallau/helpers

Weekly Downloads

2

Version

0.0.26

License

ISC

Unpacked Size

8.93 kB

Total Files

7

Last publish

Collaborators

  • tdallau