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

nodollar

v8.0.0

Published

Tiny ES6 library to simplify a few tasks usually done with jQuery

Downloads

108

Readme

no$

Tiny ES6 library to simplify a few tasks usually done with jQuery

Many features of jQuery have become obsolete with new native functions like the document.querySelector.

no$ tries to close the gap, using only 2.1kB of data (jQuery has 30kB). Browser compatibility is tested from IE11 upwards.

Usage

no$ is meant to be used as an ES6 (webpack) module.

import 'nodollar' // only polyfills

or

import $$ from 'nodollar' // import $$ as document.querySelectorAll
import { qsa, qsArray, qs, event, index } from 'nodollar' // import alias and helper functions
import $$, * as no$ from 'nodollar' // import $$ and prefixed functions

ES5

Be sure to specifically include 'nodollar' in the packages babel transpiles, since no precompiled binary is included.

Vue CLI

To make sure Vue CLI transpiles nodollar, add the following to vue.config.js:

module.exports = {
    transpileDependencies: ['nodollar']
}

Alias

A benefit of jQuery is it's short selector syntax. no$ provides an importable alias for the same benefit. qsa is also the default export.

qs('.element') = document.querySelector('.element')
qsa('.elements') = $$('.elements') = document.querySelectorAll('.elements')
qsArray('.elements') = Array.from(document.querySelectorAll('.elements'))

Functions

event

Initializes an event listener that applies to all elements and handles multiple & live events.

The first callback argument is the event.target to reduce final code size and fix the live target.

// regular
event('.elements', 'click', (el, e) => {})

// multiple events
event('.elements', 'click touchstart', (el, e) => {})

// live event
event(document, 'click', '.element', (el, e) => {})

// EventListenerOptions
event('.element', 'click', (el, e) => {}, {
    once: true,
    passive: true,
    capture: true
})

// remove all listeners (just call returned function)
const removeEvents = event('.elements', 'click', (el, e) => {})
removeEvents()

index

Returns the index of an element among it's siblings.

// regular
index(element)

// query string
index('.element')

// non-zerobased index (+ 1)
index(element, false)

automatic polyfills

yola/classlist-polyfill

adds full IE support for classList

element.closest / element.matches

adds general support for element.closest and element.matches

syuji-higa/event-listener-options-polyfill

adds IE/Edge support for EventListenerOptions

NodeList.forEach

adds general support for querySelectorAll().forEach

jQuery vs. native vs. no$

Here are some typical use cases of jQuery, with the native counterpart. The examples also show how no$ can make your life a little easier.

/*
selecting all elements
*/
$('.elements') // jQuery
document.querySelectorAll('.elements') // native
[...document.querySelectorAll('.elements')] // for array functions
qsa('.elements') // no$
$$('.elements')

/*
selecting first element
*/
$('.elements').first() // jQuery
document.querySelector('.elements') // native
qs('.elements') // no$

/*
selecting parent elements
*/
$element.parents('.parent') // jQuery
element.closest('.parent') // native (polyfilled)

/*
selecting child elements
 */
$element.find('.child') // jQuery
element.querySelectorAll('.child') // native
element.qsa('.child') // no$

/*
selecting next/previous sibling
 */
$element.next() // jQuery
$element.prev()
element.nextElementSibling // native
element.previousElementSibling

/*
extracting element index
 */
$element.index() // jQuery
[...element.parentElement.children].indexOf(element) // native
index(element) // no$

/*
extracting CSS styles
*/
$element.css('margin-top') // jQuery
window.getComputedStyle(element).marginTop // native
element.attributeStyleMap.get('margin-top') // native houdini (faster)
element.computedStyleMap().get('margin-top')

/*
setting CSS styles
*/
$element.css('margin-top', '30px') // jQuery
element.style.marginTop = '30px' // native
element.attributeStyleMap.set('margin-top', CSS.px(30)) // native houdini (faster)

/*
extracting data attributes
*/
$element.data('id') // jQuery
element.dataset.id // native

/*
checking if element has attribute
*/
$element.is('[data-active]') // jQuery
element.matches('[data-active]') // native (polyfilled)

/*
looping through elements
*/
$('.elements').each(function() { $(this).prop('checked', true) }) // jQuery
document.querySelectorAll('.elements').forEach(el => el.checked = true) // native & faster
qsa('.elements').forEach(el => el.checked = true) // no$

/*
listening for events on multiple elements
*/
$('.elements').on('click', function() { $(this).prop('checked', true) }) // jQuery
document.querySelector('.elements').forEach(element => element.addEventListener('click', e => e.target.checked = true)) // native
event('.elements', 'click', el => el.checked = true) // no$

/*
triggering an event
 */
$element.trigger('click') //jQuery
element.click() // native click
element.dispatchEvent(new CustomEvent('click')) // native other events (needs 'custom-event-polyfill')

/*
adding a css class to multiple elements
*/
$('.elements').addClass('active') // jQuery
document.querySelectorAll('.elements').forEach(el => el.classList.add('active')) // native
qsa('.elements').forEach(el => el.classList.add('active')) // no$