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 🙏

© 2025 – Pkg Stats / Ryan Hefner

ifyify

v0.1.0

Published

Functional utils

Downloads

7

Readme

ifyify Build Status

transitive verb; derivation

To create a new word by adding the suffix "-ify" to another word

Collection of non-standard functional utils. You won't find curry, bind and their friends here. Seeking for those take a look at Lo Dash or Underscore.

How to install

$ npm install ifyify --save

Usage

var ify = require('ifyify');

Callbackify

Converts a function to continuation style. function(err, arg1, arg2, ..., next)

  • The first argument: error flag;
  • The last argument: next callback (if is of type function);
  • Everything in between is considered to be the function arguments.
function add(a, b) {
    return a + b;
}

var wrapped = ify.callbackify(add);

wrapped(false, 1, 2, function(err, res) {
    console.log(res);
}); //logs 3

Factorify

Converts a constructor to a factory that can be called w/o the new operator. Also provides many method that allows to create multiple instances from a given array of arguments.

function Person(name, age) {
    this.name = name;
    this.age = age;
}

Person.prototype.sayHi = function() {
    console.log('Hi ' + this.name);
};

//lets ditch the 'new' keyword
var personFactory = ify.factorify(Person);

//now we can create instances without new
var joe = personFactory('Joe', 27);
joe.sayHi(); //logs "Hi Joe"

//and even more
//now we can create an array of instances using .many
var people = personFactory.many([['Joe', 27], ['Ann', 31], ['Nicola', 100]]);
people[2].sayHi(); //logs "Hi Nicola"

Chainify

Converts a function or an object to chainable style. Given function or object's methods will return the context it was called with.

var config = {
    setA: function(a) {
        this.a = a;
    },
    
    setB: function(b) {
        this.b = b;
    }
},
    configurable = ify.chainify(config);
    
configurable.setA(10).setB('B');

Chainify checks a function source code for having return statements in it. If there is any the given function would remain untouched.

var config = {
    getA: function() {
        return 'a';
    }
}, 
    configurable = ify.chainify(config);

configurable.getA(); //'a'

If you have hybrid functions i.e. acting as a getter or setter chainify allows to use runtime checking if a function has returned anything (non undefined).

var config = {
    a: function(a) {
        if(a === undefined) { //getter mode
            return this._a;
        }
        
        this._a = a; //setter mode
    }
}, 
    configurable = ify.chainify(config, true); //dynamic checking

configurable.a(10).a(); //10

###Arrayify A small collection of wrappers for array methods:

  • sortify sorts a given array
  • filterify filters a given array
  • foreachify applies function to every element
  • everyify checks if a predicate holds for every element
  • someify checks if a predicate holds for any element
  • reduceify reduces a given array
//sorting
var sortNumerically = ify.sortify(function(a, b) {
    return a - b;
});

var sorted = sortNumerically([1.1, 2, 1, 0.7, 1.5, 3]); //[0.7, 1, 1.1, 1.5, 2, 3]

//filtering
var clean = ify.filterify(Boolean);

var cleaned = clean([1, 0, false, "2", undefined]); //[1, "2"]