@epeli/utils
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Epeli's Javascript / Typescript utilities

Some utility functions I use across multiple projects that are not available in any de facto utility libraries like Lodash.

Very Typescript heavy.

DISCLAIMER:

Not maintaining this for anyone else. This is open source because why not. Might do breaking changes at will - although I try follow semver but I won't be doing changelogs.

So if you find something useful from this I suggest you just copy paste it to your project.

Install

npm install @epeli/utils

Exported functions

See __dtslint__ for usage examples

omit(obj: object, keys: string[]): object

Like omit() in Lodash but properly typed for Typescript.

Supports only plain objects.

strictAssign(target: object, ...sources: object[]): object

Same as Object.assign() but does not allow extending the type. Eg. the return type is always the same as target.

Works nicely with Immer.

wait(time: number): Promise

setTimeout for async functions.

withTimeout(message: string, time: number, promise: Promise)

Resolve promise within the time (ms) or reject with the message.

Readme

Keywords

none

Package Sidebar

Install

npm i @epeli/utils

Weekly Downloads

0

Version

1.0.4

License

ISC

Unpacked Size

11.3 kB

Total Files

23

Last publish

Collaborators

  • esamatti