0.32.2 • Published 7 months ago

@flekschas/utils v0.32.2

Weekly downloads
56
License
MIT
Repository
github
Last release
7 months ago

A collection of handy utility functions

NPM Version Build Status File Size Code Style Prettier Docs

This is a collection of utility functions that I keep using across different projects. I primarily created this package for myself so I don't have to re-implement certain functions over and over again, and to have a central place for testing them.

Install

npm install @flekschas/utils --save-dev

Usage

import { debounce } from '@flekschas/utils';

const hi = debounce(() => {
  console.log('I am debounced');
}, 250);

For cherry picking from a specific topic do:

import { debounce } from '@flekschas/utils/timing';

The utility functions are organized by the following topics:

  • animation
  • color
  • conversion
  • dom
  • event
  • functional-programming
  • geometry
  • map
  • math
  • object
  • other
  • sorting
  • string
  • timing
  • type-checking
  • vector

API

See API.md for the API docs.

Why yet another library for utility functions?

Generally, I follow four core goals with this collection:

  1. Reusability
  2. Performance
  3. Simplicity
  4. No dependencies

Whenever a function is reusable in a general context I might add it. When I add a function I will make sure it's performant. Finally, every function should be implement as simple as possible without harming performance. There's always a trade-off between performance and simplicity and my philosophy is the following: if the simple and complex implementation perform roughly the same, I choose the simple implementation. If a slightly more complex implementation is much faster I will favor the complex implementation. In any case, the API should always be simple and easy to understand! Finally, I want my utils functions to have no external and as little as possible internal dependencies. Why? No matter how large this collection becomes as a whole, if you only need one function, you should only ever have to bundle a single function and not a whole forrest of depending helper functions.

0.32.2

7 months ago

0.32.1

9 months ago

0.32.0

9 months ago

0.31.0

11 months ago

0.30.1

1 year ago

0.30.0

1 year ago

0.29.0

3 years ago

0.28.0

3 years ago

0.27.0

3 years ago

0.26.0

3 years ago

0.25.0

4 years ago

0.24.1

4 years ago

0.23.2

4 years ago

0.24.0

4 years ago

0.23.1

4 years ago

0.23.0

4 years ago

0.22.1

4 years ago

0.22.0

4 years ago

0.21.0

4 years ago

0.20.0

4 years ago

0.19.0

4 years ago

0.18.0

4 years ago

0.17.0

4 years ago

0.16.1

4 years ago

0.16.0

4 years ago

0.15.0

4 years ago

0.14.1

4 years ago

0.13.0

4 years ago

0.14.0

4 years ago

0.12.0

4 years ago

0.11.0

4 years ago

0.10.0

4 years ago

0.9.0

4 years ago

0.8.0

4 years ago

0.7.1

4 years ago

0.7.0

4 years ago

0.6.0

4 years ago

0.5.0

4 years ago

0.4.0

4 years ago

0.3.0

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago