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 🙏

© 2024 – Pkg Stats / Ryan Hefner

quelib

v0.1.0

Published

A small yet useful JS query framework that blends the difference between HTML nodes and NodeLists

Downloads

5

Readme

npm npm bundle size (minified) npm bundle size (minified + gzip) MIT ES2015+

Quelib

As all libs of this kind even this one can do:

$(()=>{/* Do on load */});

// query HTML nodes
let array = $(".query");

//access queried nodes
let node = $(".query")[0];

// and do something with its properties or methods.
$(".query").on("click", ()=>{});

However, why have a limited set of properties and methods to work with? Maybe you want others or all of them. With this lib you can get, set or call all properties or functions defined on queried nodes.

// Disable all .homeButtons
$(".homeButton").disabled = true;

// Get array of ids of buttons with .homeButton class
let array = $(".homeButton").id; 

// Assigns click event handler to all .homeButtons 
$(".homeButton").addEventListener("click", ()=>{/*e.g. Go to homepage*/});

Geting started

Install:

> npm i quelib

Import:

// with a bundler:
import $ from "quelib";

//or in Vanilla JS something like this:
import $ from "./node_modules/quelib/release/quelib.js";
//+ don't forget add type="module" to script tag in html

Or you can use source files in ./src/ to bundle & minify it yourself.

Reference

  • hide()
  • show()
  • toggle()

Aliases

addAlias(alias, property)

Predefined aliases

name|is alias of ---|--- on()|addEventListener() off()|removeEventListener()

Remarks

Property lookup

By default it looks in nodes' properties first; then, if not found, it looks in prototype chain. To alter this you can:

  • Use prefixes to force one or the other behavior.

    • $ to force lookup on nodes.
    • _ to force lookup in prototype chain (= standart behavior without this lib).

    To change these call setPrefixes(noMagic, magic).

  • Call setPrefixes(noMagic, magic) with noMagic set to empty string.

Usage of proxies restrict this lib to ES2015+ environments.