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

vibe-sort

v1337.42.0

Published

A library for sorting values by their vibes. 100% deterministic.

Downloads

75

Readme

Vibe Sort

vibe-sort is a powerful and unique JavaScript library that allows you to sort numbers based on their "vibe." The vibeScore function assigns a score to numbers, reflecting their inherent "vibe quality," and the orderByVibe function sorts numbers in descending order of vibe scores.

Features

  • vibeScore: Assigns a "vibe score" to any number, reflecting positive, negative, mystical, or quirky properties.
  • orderByVibe: Sorts an array of numbers based on their vibe scores, allowing you to easily determine which numbers have the best (or worst) vibes.
  • Incorporates a variety of special conditions, including but not limited to:
    • Prime numbers
    • Palindromes
    • Special sequences (e.g., Fibonacci numbers)
    • Lucky numbers like 42, and more.

Installation

You can install vibe-sort via npm:

npm install vibe-sort

Usage

The library provides two core functions: vibeScore and orderByVibe. Below are some examples of how to use them.

Example: Calculating Vibe Scores

Use vibeScore to calculate the vibe of individual numbers.

const { vibeScore } = require('vibe-sort');

console.log(vibeScore(42));  // Output: 60 (because 42 is the answer to everything)
console.log(vibeScore(69));  // Output: 30 (meme vibes)
console.log(vibeScore(1007)); // Output: 35 (secret agent vibes)

Example: Sorting by Vibe

Use orderByVibe to sort numbers in descending order of vibe.

const { orderByVibe } = require('vibe-sort');

const numbers = [42, 13, 69, 8, 1007, -7];
const sorted = orderByVibe(numbers);
console.log(sorted); // Output: [ 1007, 69, 42, 8, 13, -7 ]

Vibe Scoring Criteria

The vibeScore function considers a wide range of factors that contribute to a number's overall "vibe":

  • Prime Numbers: Receive a significant vibe bonus.
  • Divisibility: Numbers divisible by 7, 10, or 3 have enhanced vibes due to their mystical and harmonic properties.
  • Palindromes: Numbers that read the same forward and backward have a naturally high vibe.
  • Special Numbers: Special values like 42 (the answer to everything), numbers ending in 007 (secret agent vibes), and 69 (meme vibes) receive unique bonuses.
  • Negative Numbers: Depending on their properties, they may contribute negatively to their vibe.

License

This project is licensed under the WTFPL.

Contributing

Contributions are welcome! If you have any new vibe-modifying criteria you’d like to propose, feel free to create an issue or submit a pull request.

Running Tests

To run the tests, use:

npm test

Tests are written using Mocha and Chai to ensure that vibe calculations are correct and consistently reflect the true nature of number vibes.

Acknowledgements

  • Thanks to all developers who value the importance of vibes in numerical data.
  • Special mention to Mocha and Chai for making the testing process seamless.

Enjoy the vibes! ✨