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

hytzen-helpers

v1.1.4

Published

Utilities helpers functions for react projects

Downloads

116

Readme

📌 hytzen-helpers

npm version Download Count Bundle size

Helper functions for react projects.

🚀 Getting started

npm:

npm install hytzen-helpers

yarn:

yarn add hytzen-helpers

📃 Documentation

Helpers
  • money: Format a value to a currency shape.
  • percent: Format a value to a percentage shape.
  • date: Format a date string to specific shape.
  • isValidateEmail: Check if the input is valid email.
  • isValidateCPF: Check if the input is valid CPF.
  • numonly: Returns numeric characters only.
  • numtostr: Transform a number to a string.
  • strtonum: Transform a string to a number.
  • randonfy: Randomly change the order of an array.
  • generateArrayOfNumbers: Generate an array from x to y.
  • generateArrayWithXPositions: Generate an array with x positions.
  • generateMongoObjectId: Generate a random mongo object ID.
  • getFirstLetters: Return the two first letters of a string.
  • getFirstName: Return the first name of a string.
  • ctc: concat tailwind classNames.
  • makePrismaFilter: Generate a string filter for prisma queries.
  • px2num
  • convertPXToREM
  • convertPXToVH
Hooks
  • useBreakpoint
  • useSkipFirstRender
  • useLocalStorage
  • useToggle
  • useFetch
  • useKeyPress
  • useDebounce
  • useOnScreen

💻 Examples

money()

money(100)

// result: R$100,00

money(100, {
  locale: 'en-US',
  currency: 'USD',
})

// result: $100.00

percent()

percent(100)

// result: 100%

percent(0.2525, {
  locale: 'pt-BR',
  maximumFractionDigits: 2,
})

// result: 0.25%

date()

date(new Date().toString())

// result: 01/01/2023

date(new Date().toString(), {
  locale: 'pt-BR',
  dateStyle: 'short' // 'full' | 'long' | 'medium' | 'short'
  withHour: true
  onlyHour: false
})

// result: 01/01/2023 às 12:00

isValidateEmail()

isValidateEmail('[email protected]')

// result: true

isValidateEmail('johndoe')

// result: false

isValidateCPF()

isValidateCPF('123.456.789-00')

// result: false

numonly()

numonly('123.456.789-09')

// result: 12345678909

numtostr()

numtostr(123)

// result: '123'

strtonum()

strtonum('123')

// result: 123

randonfy()

randonfy([1, 2, 3, 4, 5])

// result: [3, 5, 1, 4, 2]

generateArrayOfNumbers()

generateArrayOfNumbers(1, 4)

// result: [1, 2, 3, 4]

generateArrayWithXPositions()

generateArrayOfNumbers(4)

// result: [0, 1, 2, 3]

generateMongoObjectId()

generateMongoObjectId()

// result: 63e2ab7da20f7c26aaab97e9

getFirstLetters()

getFirstLetters('John Doe')

// result: JD

getFirstLetters('John')

// result: JO

getFirstName()

getFirstName('John Doe')

// result: John

ctc()

<div className={c('w-full', 'bg-black')} />

makePrismaFilter()

const filterString = JSON.stringify({
  ...makePrismaFilter('johndoe', {
    OR: ['username'],
  }),
})

px2num()

px2num('16px')

// result: 16

convertPXToREM()

convertPXToREM('16px')

// result: 1rem

convertPXToVH()

convertPXToVH('16px')

// result: 1.62vh

⭐ Contributing

Each PR should be specific and isolated to the issue you're trying to fix. Please do not stack features/chores/refactors/enhancements in one PR. Describe your feature/implementation in the PR. If you're unsure its useful or if it is a major change, please open an issue first and get feedback.

  • Comment your code
  • Write clean code

🤝 License

MIT

Made with ❤️ by Samara Carvalho

👋🏽 Entre em contato!