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

apt.js

v0.1.3-6

Published

A few bytes long in-browser library, jQuery and RequireJS without the payload

Readme

:rocket: Apt.js – a few bytes long in-browser library

Minimalist, fast, rather-slim and pretty concise JavaScript library. Provides the flavour of both jQuery and RequireJS without the payload. Small enough to be embedded in any first-byte.

We have use this in production on Info.com and other properties since early 2009. It allowed use to reduce the payloads of our pages considerably to a just a few KBs and the number of subsequent includes/requests to just a few. Gave us immediate page rendering as it is non-blocking, reduced bandwich consumption. great with mobile traffic...

Usage

Ideally the content of dist/apt.min.js would got into the <head> of your page right below your CSS declaration however feel free to add it whichever way you want.

Short example (below $ == Apt)

<script>
  $(function(){ // wait for the DOM to ready

    // Apply a native Javascript method to a collection. 
    $('ul li').push($('<li class="bar"/>')[0]);

    // Load some files asynchrnously then run a callback
    $.src('my.css', 'my.js', function(success){});

    // Extend/add a new method using `Apt.fn`
    $.fn.toggle = function () {
      return this.each(function (e) {
        e.style.display=e.style.display=='none'?'':'none';
      })
    }
  
  // then use as follow..
  $('ul li.bar').toggle();
});
</script>

Above we use the shorthand $ to invoke Apt. Apt does not provide any jQuery like boilerplate methods but instead exposes the native JavaScript Array object methods to keep the code base light and portable. Apt stands for 'Array Prototype Touchdown'.

Apt modules

Bundle with apt.js

`Apt()`	// Core `Apt` selector object returns a collection.
`$`	// Alias of `Apt` if global `$` is free - jQuery like!
`$.fn`	// to extend Apt prototype.
`$.type()`	// Returns type
`$("ul li").each(...);`	// Iterare over the collection items.
- `$().push(el)` // Adds one or more elements to the end, and returns the new length of the collection.
- `$().pop(el)` // Removes and returns the last element from the collection.
- `$().shift(el)` // Same as pop() but from the beginning.
- `$().unshift(el)` // Same as push() but from the beginning.
- `$().slice(0,1)` // Extracts a section, returns a new.
- `$().slice(0,1,el)` // Add/remove from specific location.
- `$().sort()`  // Sorts
- `$().reverse()` // Reverses
- `$().concat()`  // Joins 2 or more
- `$().join()`  // Joins all elements into a string
- and the usual `unique()`, `reduce()`, `indexOf()`, `filter()`, `some()`, `map()`, `every()`, ...
$.src("/my_styles.css", "/my_scripts.jss", "...");
$.src("/my_scripts.jsonp");

You can also use a callback as the last argument.

$.src("/my_scripts.js", function(success) { console.log("success == true, succesfully loaded") } );
$.src("/my_styles.css", "/my_scripts.jss", "...", function(success) {} );
var callback = function(event){ console.log(event); }
$("div .link").on('mouseover', callback);
$("div .link").off('mouseover', callback);
var h = "Some <b>HTML</b>";
$('h1').html(h);
var out =$('h1').html(); // -> out == h
$('ul li').addClass('foo');
$('ul li').removeClass('bar');
$('.offers').css('diplay', 'none');
var callback = function(data, success, xhr){ console.log(data, success, xhr); }
$.ajax('https://api.github.com/users/frqnck', callback); // GET by default

var api = $.ajax('https://api.github.com/users/frqnck', callback, 'post');
api.send("foo=bar&buz=bar"); 

Additionals extra

$.getUrlVars();			//
$.getCookie('name');	//
$.rmTags(html);			//
var tpl = "Template {0} - {1}";
tpl.format(""foo", "bar");  // 
- forEach()			-applies a callback to all the elements.
- map()				- creates new array thru callback.
- every() 			- tests a callback against the elements
- some()			- similar to every() but stop at first true!
- filter()          - creates new array with the elements that pass the test.
- indexOf			- returns the index of first matching element.
- reduce() 			- Iteratively reduce the array to a single value using a callback

Test suite

The code is covered by extensive unit testing.

:arrow_forward: Test right from your Web browser

Local automated test

We use headless Chrome and PhantomJS to run our automated testing. Installation is straight forward just run

$ yarn install

To run the automated tests:

$ yarn test

You can replace yarn by npm if that what rock your boat.

This package is also available via NPM.

Contribution

Pull requests and ★ Stars are always welcome. For bugs and feature request, please open an issue.

License

This work is licensed under the MIT license – see the LICENSE for the full details.Copyright (c) 2009-2018 Franck Cassedanne