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

@techmmunity/utils

v1.10.1

Published

Lightweight utils for every project

Downloads

33

Readme

Techmmunity - Utils

Package of utils, make in a way to let you import only the functions that you really need, so it doesn't make your project heavier than it needs to be.

Every util is optimized to only contain the necessary code, so even if this package have 1M utils, if you are using babel, webpack or @vercel/ncc, the compiled code will only contain the utils that you are using.

We also have zero external dependencies, so everything that can cause trouble to your project is inside this repository! It makes easier to check and validate if the code match your expectations and is good enough for your project.

:warning: WARNING :warning:

The package may not be updated so often, but it not means that it has been abandoned. We do the utils in a way to (almost) never have to touch it again, and we only update the package to add new features, what may don't need to happen so often.

You can safely use this package, even if it don't receive updates in a year, and if you find any bug, you can report it by creating a issue in the GitHub repository, or create a PR to fix it! We will always give it special attention.

Install

With Yarn:

yarn add @techmmunity/utils

With NPM:

npm i @techmmunity/utils

Docs

Miscellaneous

| function | description | | ---------- | ----------------------------------------------- | | chunk | Chunks an array | | cleanObj | Remove undefined and null values from an object | | sleep | Await the amount of time specified (in seconds) | | nest | Nest objects that have been unnested | | unnest | Plain objects and arrays |

get*

| function | description | | ---------------------- | ---------------------------------------------------------------------- | | getArrayUniqueValues | Remove duplicated values of an array (only work with primitive values) | | getAspectRatio | Gets the aspect ratio (like 16:9, 4:3) | | getEnumValues | Return the enum values | | getGCD | Gets the Greatest Common Divisor (GCD) | | getHexColorLuma | Return the color luma of a hex color | | getRootPath | Get root path to something from the root folder of the process | | getTypeof | Fix native "typeof" |

has*

| function | description | | -------------------- | ---------------------------------- | | hasEmojis | Return true if value has emojis | | hasHtmlTags | Return true if value has html tags | | hasRequiredEnvVars | Verify if all env vars are defined | | hasUrl | Return true if value has a url |

is*

| function | description | | -------------------- | ----------------------------------------------------------------- | | isAlphanumeric | Return true if value is a number or a letter | | isBetween | Return true if value is a number between 2 values | | isBrazilianPhone | Return true if value is a brazilian phone | | isClassInstance | Return true if value is a class instance | | isCnpj | Return true if value is a CNPJ | | isCpf | Return true if value is a CPF | | isDarkHexColor | Return true if value is a dark hex color | | isDate | Return true if value is a valid date in the specified format | | isDateDMY | Return true if value is a valid date DD-MM-YYY | | isDateDMYS | Return true if value is a valid date DD/MM/YYY | | isDateMDY | Return true if value is a valid date MM-DD-YYY | | isDateMDYS | Return true if value is a valid date MM/DD/YYY | | isDateYMD | Return true if value is a valid date YYYY-MM-DD | | isDateYMDS | Return true if value is a valid date YYYY/MM/DD | | isDivisibleByTen | Return true if value is divisible by ten | | isEmail | Return true if value is a valid email | | isEmoji | Return true if value is an emoji (has some false-positives!) | | isEmptyArray | Checks if is an array and it's empty | | isEmptyObject | Checks if is an object and it's empty | | isEven | Return true if value is a even number | | isFloat | Return true if value is a float number (.0 numbers doesn't count) | | isHerokuApiKey | Return true if value is a heroku api key | | isHexColor | Return true if value is a valid hex color | | isInt | Return true if value is a float number | | isIpv4 | Return true if value is a valid ipv4 | | isIpv4WithMask | Return true if value is a valid ipv4 with mask | | isIsoDate | Return true if value is a ISO Date | | isLeap | Return true if value is a leap year | | isLightHexColor | Return true if value is a light hex color | | isMaskedCnpj | Return true if value is a masked CNPJ | | isMaskedCpf | Return true if value is a masked CPF | | isNumeric | Return true if value is a numeric string | | isOdd | Return true if value is a odd number | | isPackageInstalled | Return true if the package is installed | | isStrongPassword | Return true if value is a strong password | | isTimeWithFraction | Return true if value is a time in the format hh:mm:ss.s | | isTimezone | Return true if value is a time zone (Ex: +01:00, UTC, -12:00) | | isUrl | Return true if value is a valid url | | isUsername | Return true if value is a valid username | | isUuidV4 | Return true if value is a valid uuid (v4) |

isNot*

| function | description | | ------------------ | ----------------------------------------- | | isNotEmptyArray | Checks if is an array and it's NOT empty | | isNotEmptyObject | Checks if is an object and it's NOT empty |