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

condtree

v1.0.1

Published

A novel approach to manage complex conditional logic in JavaScript using an intuitive tree structure.

Downloads

7

Readme

CondTree 🌳

A novel approach to managing complex conditional logic in JavaScript. This module provides an intuitive and structured way to handle nested conditions, enhancing code readability and maintainability. Ideal for scenarios with multiple intertwined conditionals.

Tired of feeling like you're traversing a dense forest 🌲🌲🌲 with your complicated, nested conditional statements in JavaScript? Fear no more! condtree is here to turn those tricky if-else labyrinths into a walk in the park. 🌞

Description 📖

CondTree is a one-of-a-kind module to manage complex conditional logic in JavaScript in an intuitive, tree-like structure. It makes your code more readable 📚, maintainable 🛠️, and, most importantly, less likely to scare off other developers! 🙀

Installation 🏗️

If you're ready to say goodbye to traditional if-else nightmares, install condtree with npm:

npm install condtree

Usage 🚀

Here's how you can use condtree to simplify your life:

import conditionTree from 'condtree';

let x: number = 15;

let result = conditionTree({
    condition: () => x > 10,
    value: () => console.log("x is so large, it might have its own gravitational field! 🪐"),
    children: [
        {
            condition: () => x > 5,
            value: () => console.log("x is pretty big, it could probably lift 🏋️"),
            children: [
                {
                    condition: () => x > 0,
                    value: () => console.log("x is small, but it's trying its best! 💪"),
                    children: []
                }
            ]
        }
    ]
});

In this example, if x is greater than 10, we'll let the world know about its impressive size. If x is not that enormous but still larger than 5, we acknowledge its medium size. And if x is not bigger than 10 or 5, but still manages to be more significant than 0, we cheer for its efforts.

Contributing 🤝

Got an idea to make condtree even better? Fork the repo and add your genius to it, then submit a pull request. All contributions are heartily welcome! 😄

License 📜

MIT

Adventure is out there! 🌍 Start making your conditional logic as fun as a tree-climbing adventure with condtree. Your fellow developers (and your future self) will thank you! 🌳🧗‍♀️🙏