npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@paprika/helpers

v2.4.2

Published

JavaScript and React helper utilities

Downloads

32,599

Readme

@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

callAll(functions[])

Returns a function that will call all functions passed as arguments.

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

getActiveElement()

Returns the element that is currently focussed, even when that element is found within an open web component.

isElementContainsFocus(element)

Returns true if the element that is currently focussed 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().

Links