1.1.16 • Published 11 months ago

@emotionagency/utils v1.1.16

Weekly downloads
1
License
MIT
Repository
github
Last release
11 months ago

Useful utilities from the emotion-agency

Instalation

npm i @emotionagency/utils

or

yarn add @emotionagency/utils

Usage

Raf

Custom wrapper around standard API of requestAnimationFrame to optimize performance

import {raf} from '@emotionagency/utils'

\\ subscribe
raf.on(fn)

unsubscribe
raf.off(fn)

Resize

Custom wrapper around standard API of resize event with debounce function to optimize performance

import {resize} from '@emotionagency/utils'

\\ subscribe
resize.on(fn)

unsubscribe
resize.off(fn)

Lerp

Standart lerp function

import {lerp} from '@emotionagency/utils'

lerp(first number, second number, interpolation value)

Clamp

Standart clamp function

import {clamp} from '@emotionagency/utils'

clamp(clamping value, min value, max value)

CreateNewElement

A function that creates a new DOM-element with the ability to immediately assign the necessary classes to it

import {createNewElement} from '@emotionagency/utils'

createNewElement(tag, classes)

Delay

A function that creates a Promise with delay

import {delayPromise} from '@emotionagency/utils'

async delayFunc = () => {
  await delayPromise(1000)
  //logic
}

Keys Generator

A function that generate random string by length

import {keysGenerator} from '@emotionagency/utils'

const randomKey = keysGenerator(10)
1.1.16

11 months ago

1.1.15

11 months ago

1.1.12

1 year ago

1.1.11

1 year ago

1.1.14

1 year ago

1.1.13

1 year ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.10

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.0

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.5

5 years ago

0.0.6

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago