Socket
Socket
Sign inDemoInstall

@emotionagency/utils

Package Overview
Dependencies
0
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @emotionagency/utils

Useful utilities from the emotion-agency


Version published
Weekly downloads
26
increased by116.67%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

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)

Keywords

FAQs

Last updated on 16 Feb 2024

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc