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

hpjs

v0.4.1

Published

helpful javascript modules

Readme

#hpjs hpjs contains some tools help for javascrit development.

All the modules are wrote in nodejs's module style, using my gulp-defmod or browserify convert it for front-end.

base

Base functions.

validate chain

Combine mulitple validator as a chain, the error will always first one.

var validate = require('hpjs/validate')
var validator = require('hpjs/validator')

var length = validator.length(3, 10, 'wrong length')
var chars = validate.allCharsIn('abcdefghijklmnopqrstuvwxyz', 'bad chars')

var valid = validate.use(validate.use(length, chars))

console.log(length('abcdefghijklmnopqrstuvwxyz'))
console.log(chars('0123456789'))
console.log(valid('abcdefghijklmnopqrstuvwxyz0123456789', '111111', 'zzzz1'))

api

Simple library help for send http request to backend api server support both browser and nodejs.

  • NodeJS(Express)
var api = request('hpjs/api')

// default backend on expressjs
function handle(req, resp) {
    var a = api.sendPost('/user/info', req, {data:{}})
    var process = function(res) {
        console.log(res.statusCode, res.data)
    }
    
    a.success(process)
    a.fail(process)
    a.error(process)
    a.any(process)
}
  • Browser
<script type="text/javascript" src="/js/dist.js"></script>
<script type="text/javascript">
    var process = function(res) {
        console.log(res.statusCode, res.data)
    }

    var api = require('hpjs/api')
    var a = api.sendPost('/user/info', {data:{}})
    
    a.success(process)
    a.fail(process)
    a.error(process)
    a.any(process)    
</script>

jquery-tabswitch

Switch the active tab by location.path, depends on jquery's dom selector.

var tabswitch = require('hpjs/jquery-tabswitch')
var opts = null
tabswitch(opts).apply({
    '/':'index',
    'user':'',
    'blog':''
})

Custom options with api.options.

cookie

Porting from jquery-cookie.

var cookie = require('hpjs/cookie')
cookie.get('uid')

cookie.remove('uid')

cookie.set('uid', '12345')

cookie.config.defaults = {} // default cookie config

jquery-submit

Switch submit button's state.

var submit = require('hpjs/jquery-submit')

submit({
    btn:'#submitBtn',
    loadingText:'Loading',
    errField:'#errMsg',
    fields:[
        '#username', 
        '#password', 
        {
            field:'#content', 
            trim:false
        }
    ],
    callback: function(username, password, report) {
        var err = ajax(user, password)
        if (err) {
            report(err)
        } else {
            location.href = '/'
        }
    }
})

router

a simple router support variables.

var router = require('hpjs/router')()

router.add('/user/:id/articles', function(params) {
    console.log(params.param('id'), param.query('page'))    
})

router.handle('/user/001/articles?page=1')

jquery-proute

router + pushState.

var proute = require('hpjs/jquery-proute')
var add = proute({
    source:'a.proute',
    target:'#proute-container',
})

add('/user/:id/articles', function(params, pushState, a) {
    pushState(params.param('id'), a.text()) // content, title
})