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 🙏

© 2026 – Pkg Stats / Ryan Hefner

vej

v0.5.0

Published

Clean declarative remote resource manipulation

Readme

#Vej.js (experimental)

Vej.js enables you to create a declarative layer on top of your HTTP library of choice.

Our goal is to allow you to define your resources whithout caring about the underlying HTTP library that's being used. So that you can later on replace it without having to change too much on your own code. You would only tell Vej what proxy to use given your new HTTP library.

##Usage

###Creating a resource Calling the resource function will give you a function with a few inner functions that maps to four default HTTP verbs GET, POST, PATCH & DELETE.

var jedis = vej.resource("jedis", vej.proxies.majaX);

jedis.all(); // GET /jedis
jedis.create({name: "Anakin Skywalker"}); // POST /jedis {name: "Anakin Skywalker"}
jedis("anakin-skywalker").detail(); // GET /jedis/anakin-skywalker
jedis("anakin-skywalker").update({
  name: "Darth Vader"
}); // PATCH /jedis/anakin-skywalker {name: "Darth Vader"}
jedis("anakin-skywalker").remove(); // DELETE /jedis/luke-skywalker

###Extending a resource Vej lets your extend a resource with extra actions:

var jedis = vej.resource("jedis", vej.proxies.majaX, function(){
  this.collection.get("with_experience"); // GET /jedis/with_experience
  this.collection.post("send_to_battle"); // POST /jedis/send_to_battle
  this.collection.patch("stand_your_ground"); // PATCH /jedis/stand_your_ground
  this.collection.remove("fallback"); // DELETE /jedis/fallback

  this.member.get("jedis_killed"); // GET /jedis/:id/jedis_killed
  this.member.post("add_disciple"); // POST /jedis/:id/add_disciple
  this.member.patch("change_lightsaber"); // PATCH /jedis/:id/change_lightsaber
  this.member.remove("remove_rank"); // DELETE /jedis/:id/remove_rank
});

jedis.with_experience({lightsaber: "double"}); // GET /jedis/with_experience {lightsaber: "double"}
jedis.send_to_battle({strategy: "peace & love"}); // POST /jedis/send_to_battle {strategy: "peace & love"}
jedis.stand_your_ground({formation: "cocoon"}); // PATCH /jedis/stang_your_ground {formation: "cocoon"}
jedis.fallback({with: "tail between your legs"}); // DELETE /jedis/fallback {with: "tail between your legs"}

jedis("anakin").jedis_killed({which: "jedi"}); // GET /jedis/anakin/jedis_killed {which: "jedi"}
jedis("anakin").add_disciple({name: "star killer"}); // POST /jedis/anakin/add_disciple {name: "star killer"}
jedis("anakin").change_lightsaber({color: "red"}); // PATCH /jedis/anakin/change_lightsaber {color: "red"}
jedis("anakin").remove_rank({which: "jedi"}); // DELETE /jedis/anakin/remove_rank {which: "jedi"}

###Limiting resource creation

Vej allows you to limit the amount of actions created for a given resource.

####Only

var jedis = vej.resource("jedis", vej.proxies.majaX, {only: ["all", "remove"]});

jedis.all() // GET /jedis
jedis.create // undefined
jedis("anakin").detail // undefined
jedis("anakin").update // undefined
jedis("anakin").remove() // DELETE /jedis/luke-skywalker

####Except

var jedis = vej.resource("jedis", vej.proxies.majaX, {except: ["all", "remove"]});

jedis.all // undefined
jedis.create({name: "Anakin"}) // POST /jedis {name: "Anakin"}
jedis("anakin").detail() // GET /jedis/anakin
jedis("anakin").update({name: "Vader"}) // PATCH /jedis/anakin {name: "Vader"}
jedis("anakin").remove // undefined

##Promises Vej wraps every request with a promise (Promises/A+). We rely on then/promise to provide this functionality.

users("luke-skywalker").detail().then(function(data){
  data // {name: "Luke Skywalker", age: 26, midichlorians: 3000}
}, function(error){});

##Available proxies

  • majaX - https://github.com/SimonWaldherr/majaX.js