Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More

@flekschas/utils

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flekschas/utils

A set of utility functions I use across projects


Version published
Weekly downloads
658
decreased by-2.23%
Maintainers
1
Weekly downloads
 
Created

A collection of handy utility functions

NPM Version Build Status File Size Code Style Prettier

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 over and over again and 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

Why

The three core goals of this collection are:

  1. Reusability
  2. Performance
  3. Simplicity

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!

Keywords

FAQs

Package last updated on 24 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts