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

youtools

v1.0.18

Published

collection of re-usable utils without need of having a dependency

Downloads

431

Readme

YOUTools

(Your Own Utility Tools)

logo

It's a ~~utility library~~ collection of small utilities that you can copy and paste into your app.


NPM version Tests

Motivated by the fact that the current situation forces you to choose between micro-libraries or big chunks of dependencies like Lodash. I’m not against things like Lodash at all, but I believe it’s frustrating to:

  • install lodash just for debounce;
  • OR install separate debounce library;
  • OR write debounce in one project and then copy it manually to every new one;
  • OR rewrite debounce from scratch each time;

So this collection is something I’ll be using myself from project to project, and I’ll be happy if you want to use it too!

This thing is highly inspired by shadcn/ui (I mean, I even used chunks of code)

Usage

This collection is meant to be used with npx. When you execute a command it will copy source file (or transpiled js file, if you opt out typescript) to your codebase. You will be able to use, change, do whatever you want with it.

List of utils available here If you didn't find util that you're looking for, then check this.

There are only 2 commands: init, add. Each command has -h flag, so you can check how to use it.

Config

You can optionally create a config file using

npx youtools@latest init

Options:

-t, --typescript <bool>     use typescript (tsconfig should exist in project). (default: true)
-o, --overwrite <bool>      overwrite existing files. (default: false)
-a, --appendToIndex <bool>  append to utils index file (default: true)
-p, --path <path>           the path to add the utils to. (default: "lib/utils")
-s, --silent <bool>         mute output. (default: false)
-h, --help                  display help for command

Default config looks like this:

{
  "typescript": true,
  "overwrite": false,
  "appendToIndex": true,
  "path": "lib/utils",
  "silent": false
}

Add

Use this to install specific util. You can install multiple at a time, space separated.

npx youtools@latest add [options] [utils...]

Options:

-t, --typescript <bool>     use typescript (tsconfig should exist in project). (default: true)
-o, --overwrite <bool>      overwrite existing files. (default: false)
-a, --appendToIndex <bool>  append to utils index file (default: true)
-p, --path <path>           the path to add the util to.
-s, --silent                mute output. (default: false)
-h, --help                  display help for command

If you use config file – options from config will override defaults, unless explicitly specified in command.

Example:

npx youtools@latest add left-pad

This will copy left-pad.ts to your lib/utils and append export * from "./left-pad" to lib/utils/index.ts file

Contribution

Everyone is welcome to contribute.

I will be happy if you want to add your own util to collection. Just fork repo, add util, add tests for it, create PR. I will check and merge it asap!