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

@paprika/helpers

Package Overview
Dependencies
Maintainers
5
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@paprika/helpers

JavaScript and React helper utilities

  • 2.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5K
decreased by-16.76%
Maintainers
5
Weekly downloads
 
Created
Source

@paprika/helpers


Description

JavaScript and React helper utilities.


Installation

yarn add @paprika/helpers

or with npm:

npm install @paprika/helpers

Usage

Import the helper function you want to use by name from the Paprika helpers package:

import { helperFunction } from "@paprika/helpers";

Polyfills must be imported directly from their source in the lib folder. For example:

import "@paprika/helpers/lib/polyfills/elementClosest";

Contents


extractChildren(children, types[])

Get a hash table of components from chilren argument where the displayName property of child matches an item provided in the types argument with the keys of the return object matching the items in types.

extractChildrenProps(children, target)

Get the props object from the target argument component type if it exists in children argument.

isDevEnv()

Returns true if NODE_ENV is undefined or "development".


Custom PropTypes

A variety of custom React prop types including:

  • ShirtSizes
  • AlignTypes
  • deprecated
  • InputValidTypes
  • FocusPropTypes
  • RefOf

DOM Functions

isElementContainsFocus(element)

Returns true if the document.activeElement is the element argument, or any descendent of element.


Components

<LockBodyScroll>

Sets body overlow to hidden.

<Portal>

Wrapper for ReactDOM.createPortal.


Hooks

useDebounce(value, delay)

Provides a value after a specified delay.

useForwardDomRef(ref, parentRef)

Set parentRef to ref.

useMountedRef()

Provides a ref with a current value of true if component is (still) mounted.

usePrevious(value)

Provides the previous value of the value argument.


Polyfills

elementClosest

IE polyfill for Element.closest().

elementScroll

IE polyfill for Element.scroll(), Element.scrollTo(), Element.scrollBy().


  • GitHub source code
  • Create GitHub issue
  • CHANGELOG

FAQs

Package last updated on 19 Jan 2021

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc