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

js-magic-toolbox

v1.0.0

Published

๐ŸŽฉ A magical collection of JavaScript utilities that make coding feel like wizardry!

Downloads

12

Readme

๐ŸŽฉ JS Magic Toolbox

Make JavaScript development magical with this awesome collection of utility functions! No complex stuff, just pure magic! โœจ

๐ŸŒŸ Features

  • ๐Ÿ”ฅ Super easy to use
  • ๐ŸŽฏ TypeScript support
  • ๐ŸŽจ Cool console colors
  • ๐Ÿš€ Powerful array and object utilities
  • ๐Ÿ“… Smart date functions
  • ๐ŸŽญ String transformation magic

๐Ÿ“ฆ Installation

npm install js-magic-toolbox

๐ŸŽฎ Usage Examples

๐Ÿ”ฎ Array Magic

import { MagicArray } from 'js-magic-toolbox';

// Remove duplicates (even nested objects!)
const arr = [
  { name: 'John', age: 30 },
  { name: 'John', age: 30 },
  { name: 'Jane', age: 25 }
];
const unique = MagicArray.uniqueDeep(arr);
// Result: [{ name: 'John', age: 30 }, { name: 'Jane', age: 25 }]

// Get random items
const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
const random = MagicArray.pickRandom(numbers, 3);
// Result: [7, 2, 9] (random each time!)

// Perfect shuffle
const shuffled = MagicArray.perfectShuffle(numbers);
// Result: [3, 7, 1, 9, 2, 5, 4, 8, 6, 10] (random each time!)

๐ŸŽญ Object Magic

import { MagicObject } from 'js-magic-toolbox';

// Find all paths to a value
const obj = {
  user: {
    details: {
      name: 'John',
      contacts: {
        email: '[email protected]'
      }
    },
    settings: {
      email: '[email protected]'
    }
  }
};

const paths = MagicObject.findValuePaths(obj, '[email protected]');
// Result: ['user.details.contacts.email', 'user.settings.email']

// Transform all strings
const transformed = MagicObject.transformStrings(obj, str => str.toUpperCase());
// All strings in the object are now uppercase!

๐ŸŒˆ String Magic

import { MagicString } from 'js-magic-toolbox';

// Convert to different cases
const str = "Hello World";
const cases = MagicString.toCases(str);
// Result: {
//   camel: 'helloWorld',
//   snake: 'hello_world',
//   kebab: 'hello-world',
//   start: 'Hello World',
//   constant: 'HELLO WORLD'
// }

// Find overlapping matches
const text = "aaaa";
const positions = MagicString.findAllOverlapping(text, "aa");
// Result: [0, 1, 2] (finds all "aa" including overlapping ones!)

โฐ Date Magic

import { MagicDate } from 'js-magic-toolbox';

// Get relative time
const date = new Date('2023-12-25');
console.log(MagicDate.relative(date));
// Result: "in 5 months" (or whatever is relative to now)

// Get random date
const start = new Date('2023-01-01');
const end = new Date('2023-12-31');
const randomDate = MagicDate.random(start, end);
// Result: Random date between start and end!

// Count business days
const businessDays = MagicDate.businessDaysBetween(start, end);
// Result: Number of business days (excluding weekends)

๐ŸŽจ Console Magic

import { MagicConsole } from 'js-magic-toolbox';

// Pretty success message
MagicConsole.success('Task completed!');
// Shows: โœจ Task completed! (in green)

// Error message
MagicConsole.error('Something went wrong!');
// Shows: ๐Ÿ’ฅ Something went wrong! (in red)

// Rainbow text
MagicConsole.rainbow('This is awesome!');
// Shows text in rainbow colors!

// Box message
MagicConsole.box('Important Message');
// Shows:
// โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
// โ”‚ Important Message   โ”‚
// โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿค Contributing

Feel free to contribute! Open an issue or submit a pull request.

๐Ÿ“ License

MIT