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

yarjs

v1.0.4

Published

Yet Another Require javascript solution... for the that inner pirate who doesn't want to read a boat load of documentation.

Readme

yarjs

Yet Another Require javascript solution... for the that inner pirate who doesn't want to read a boat load of documentation.

About

yarjs is basically a lightweight (476 bytes uglified) solution replacement for stuff like browserify and RequireJS.

It exposes two methods (__import and __export) which allow you to never worry about ordering of your scripts

Installation

npm install yarjs --save

Use it with expressjs

app.use('/yar.js', express.static(path.join(__dirname, 'node_modules/yarjs/dist/yar.js')));

views/layout.jade

doctype html
html
  head
    title= title
    link(rel='stylesheet', href='/stylesheets/style.css')
  body
    block content
    script(src='/yar.js')
    script(src='/javascripts/crazy_pirate_lib.min.js')

Usage

Load yar.js first, all other files can be loaded in any order. gulp-concat them all if you like.

Examples

main/sub1/Class1.js

		
(function() {
		
	function Class1() {
		this.saymyname();
	}

	Class1.prototype.myname = 'Class1';

	Class1.prototype.saymyname = function() {
		console.log(this.myname);
	};

	__export('main.sub1.Class1', Class1);

})(); // EOF

main/sub2/Class2.js


__import(

	'main.sub1.Class1',

	function(Class1) {
	
		function Class2() {}
		
		Class2.prototype.constructor = Class1
		Class2.prototype = new Class1();
		Class2.prototype.myname = 'Class2';

		__export('main.sub2.Class2', Class2);

	}

); // EOF

main/do_something.js


__import(

	'main.sub1.Class1, main.sub2.Class2',

	function(Class1, Class2) {
	
		var obj1 = new Class1();
		var obj2 = new Class2();

		obj1.saymyname();
		obj2.saymyname();

	}

); // EOF

main/do_something_a_different_way.js last argument is the callback

__import(

	'main.sub1.Class1',
	'main.sub2.Class2',

	function(Class1, Class2) {
	
		var obj1 = new Class1();
		var obj2 = new Class2();

		obj1.saymyname();
		obj2.saymyname();

	}

); // EOF

Circular References

Break up your classes that need to reference each other so that they can grab a reference to each other...

Circular1.js


__import(

	'Circular2.ref',

	function(Circular2Ref) {
		
		// cannot call Circular2Ref() yet because Circular2 is
		// waiting for us to export in order to create its constructor
		
		Circular1.prototype.myname = 'no_name';
		
		Circular1.prototype.constructor = function(myname) {
			this.myname = myname || this.myname;
		};
		
		Circular1.prototype.setMyName = function() {
			this.myname = 'Circular1';	
		};
		
		Circular1.prototype.sayMyName = function() {
			console.log('My name is', this.myname);
		};
		
		Circular1.prototype.sayMyOtherName = function() {
			
			if( !this.otherSelf ) this.otherSelf = new Circular2Ref();
			this.otherSelf.sayMyName();
			
		};
		
		__export('Circular1', Circular1); // Circular2's import will now execute

	}
	
)(); // EOF

Circular2.js

Circular2 has to wait for Circular1 to define it's prototype so that Circular2 can call new Circular1() to set its prototype.

(function() {
	
	var Circular2 = {};
	
	__export('Circular2.ref', Circular2); // Yield to Circular1 so it can finish defining its prototype
	
	// now we can import Circular1
	
	__import(
	
		'Circular1',
	
		function(Circular1) {
			
			Circular2.prototype = new Circular1();
			Circular2.prototype.name = 'Circular2';
			Circular2.prototype.constructor = Circular1;
			
			var c1 = new Circular1();
			
			c1.sayMyName(); // My name is no_name
			
			c1 = new Circular1('John');
			c1.sayMyName(); // My name is John
			
			var c2 = new Circular2();
			c2.sayMyName(); // My name is Circular2
			
			c2 = new Circular2('Jack');
			c2.sayMyName(); // My name is Jack
			
			c1.sayMyOtherName(); // My name is Circular2
			c2.sayMyOtherName(); // My name is Circular2
			
		}
		
	);
	
	
	
)(); // EOF