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

bigcoffee

v1.0.0

Published

BigCoffee ☕️ is a next generation DOM toolbox, written in EcmaScript 6 and inspired by (but unlike) jQuery.

Downloads

1

Readme

☕️

new c('.BigCoffee')

BigCoffee is a next generation DOM toolbox, written in EcmaScript 6 and inspired by (but unlike) jQuery.

Install

You can add this library using our CDN:

<script async src="//missing">

Or just include this in your Node project:

$ npm install bigcoffee
$ yarn add bigcoffee

Usage

First of all, instance the library passing a CSS selector to constructor:

const elements = new c('div') // or new BigCoffee('div')

.find(selector)

You can find elements inside inputing a new selector across query method:

const links = elements.find('li a')

.first()

Return the first element.

elements.first()

.index(index)

Return element by the index.

elements.index(2)

.last()

Return the last element.

elements.last()

Loading BigCoffee

Before start DOM manipulation, you'll need to listen the ready static method in order to wait DOM load.

function onReady () {
  BigCoffee.ready(function (event) {
    // Your code goes here.
  })
}

We encourage you to load the library asynchronously, so BigCoffee always fire window.BigCoffeeReady after load.

if (BigCoffee) {
  onReady()
} else {
  window.BigCoffeeReady = onReady
}

Writing a Module

A module will add methods into the BigCoffee root. There is a native method called extends which must be invoked to merge your custom methods with the library.

In the example below we'll implement two custom methods which will paint the color and the background-color with a custom color respectively.

BigCoffee.extends({
  color (color) {
    for (let element of this) {
      element.style.color = color
    }

    return this
  },

  fill (color) {
    for (let element of this) {
      element.style.backgroundColor = color
    }

    return this
  }
})

As you can see, we have returned this in the methods to enable chaining, so you can use like this to paint all div's:

// First of all, store the elements.
const elements = new c('div')

// Now you can chain the methods.
elements.color('red').fill('yellow')

There is a one more thing stuff: you can also input a function to extends which must return an object with the methods:

BigCoffee.extends(function () {
  function borderColor (color) {
    for (let element of this) {
      element.style.borderColor = color
    }

    return this
  }

  return {
    borderColor
  }
})

Note that we always loop the elements (for (let element of this) {}) to apply the changes for all.

Understaing this repository.

  • dist contains compiled versions of the library and the modules.
  • docs contains docs for all modules.
  • src contains the source code.

Contributing

You can help this project in several ways.

Roadmap

We would like to:

  • Create a website.
  • Create more native and custom modules.
  • Publicize and implement the library wherever as possible.
  • Separate modules into single packages.

About the native modules, we want provide these:

  • [ ] Ajax
  • [ ] Animations
  • [x] Attributes
  • [x] Classes
  • [ ] Elements
  • [ ] Events
  • [ ] Forms
  • [ ] Styles

Please keep the code pattern.

Building

We use Gulp to generate all the versions.

Missing.