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

bling

v0.12.3

Published

The kitchen sink library.

Downloads

310

Readme

About


BlingJS is a kitchen sink, inspired by jQuery, but more consistent, and useful in the browser and on the server.

In particular, it is more consistent about doing set-based operations.

  • All operations return sets wherever possible.
  • As much as possible is a plugin, even core operations.

So, while it supports all the same basic operations as jQuery, they behave slightly different.

For instance, the .html() operation.

  • in jQuery, returns the innerHTML of the first DOM node in the set.
  • in Bling, you get a set of html strings, one from each node.

This set philosophy means that set operations are useful:

  • .intersect()
  • .union()

These kinds of set operations are part of the "core" plugin.

Everything is a plugin; since plugins can not only extend the prototype (by returning an object full of extensions), but can also inject code into the Bling constructor (by using $.hook), there is very little needed outside.

The core plugin also provides some cool new things, like the .select() and .zap() operations.

The .select() operation will collect a single property from every item in a set.

.html() is short-hand for .select('innerHTML').

  • You can extract nested values, e.g. $(nodes).select('style.color').
  • Arbitrary nesting depth, and arrays, e.g. $(nodes).select('childNodes.1.className').

The .zap() operation is for doing bulk assignment.

.html("new html") is short-hand for .zap('innerHTML', "new html").

More than just simple assignment, it can also 'stripe' values across a set; and map functions over selected properties.

$("li").zap('className', ["odd", "even"])
$("li").zap('childNodes.1.style.top', -> $.px @+10 )

This example moves every list-item's 2nd-child up by 10 pixels, and allows you to continue chaining on the list-items (not the moved children in this case).

Installation


% npm install bling
% node
> require("bling")
> $([1,2,3,4]).scale(2.5).sum()
25