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

blodash

v0.0.14

Published

Lodash didn't blow hard enough

Downloads

6

Readme

bLodash

Build Status We don't lie about our coverage

Why does this library exist? It's the satirical edition of the absolutely legendary library that is lodash.

the one true god

Using blodash allows you to liberate your code from nasty issues with using any sort of native features and tries to take all of the guesswork out of whether something truly exists or not. To put it simply, it's the last and only library you will ever need from hereon out.

Don't be fooled about using built in features of Javascript. You might not know when those features are going to be ripped out from under you and change. So you need a reliable callback based solution.

bLodash extensions

Native#If

Evaluates your function or boolean and will decide to call your callback if it evaluates to true. If boolean evaluates as false an exception (b_.E.FalseIf) is thrown.

b_.if( function|boolean, callback );

Native#Else

Evaluates your if expression and catches the false exception and returns undefined.

b_.else( function|boolean, callback );

Native#Switch

Evaluates your switch and catches any exception that may be thrown in your case statements. Throws an exception only if no statement is found with your value(default case).

//Where switched value is known at creation
b_.switch( function|value );

//When switch statement isn't known until later
b_.switch( function|value, callback );

b_.switch( ... )
    .eval( value, defaultCase );

Native#TryCatch

    b_.try(function(){
        throw new Error()
    })
        .catch(Error, function(){
            return true;
        })
        .exec();

bLodash Example

Simple if

var a = true;
var value = b_.if( a, function(){
    return 'if-true';
});

console.log(value);
// if-true

Exception Safe If:

Note, there is no way to return a value from an else. You must have a functional callback to be able to get values out of an else.


b_.else(function() {
    b_.if(function() {
        return b_.else(function() {
            b_.if(value, function() {
                cb(b_.null);
            });
        }) === undefined;
    });

    cb(b_.true);
});

Functional Switch:

Never have to worry about native switch again

    b_.switch('case1')
        .case('case0', function(){
            iLoveBlodash();
            return null; //Equivalent to break
        })
        .case('case1', function(){
            lodashIsRevolutionary();
            return null;
        });
var _switch = b_.switch();

for(var i = 0; i < 50; i++)
    _switch.case(i, function(){ console.log(i); });

_switch.eval(5);
// 5 6 7 8 9 10 11 ...

Try/Catch:

Never guess about what error is thrown again

    b_.try(function(){
        this.object.does.not.work
    })
        .catch(ReferenceError, function(){
            return true;
        })
        .catch(Error, function(){
            return null
        })
        .exec();

    try {
        this.object.does.not.work
    } catch(e) {
        if(e instanceof ReferenceError){
            return true;
        } else {
            return null;
        }
    }