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

elementsJS

v0.9.30

Published

A Very Unique and Modern JavaScript DOM Manipulation/Convenience Function Library.

Downloads

25

Readme

Click Here for the Full API Documentation.

Installation

There are a couple different ways to use elementsJS. The first is by simply using the function library. The second, is to make use of the new convenient elements syntax. If you would like to use the elements syntax, a simple compilation step is necessary. If you'd like to learn more, click here.

The first step, however, is to simply install the library. elementsJS can be installed using either bower or npm package managers and required CommonJS style, or import-ed es6 style. You may also include the cdn link in your html.

elementsJS CDN:

<script type='text/javascript' src='https://github.com/ejames9/elementsJS/e531c38/index.js'></script>

npm:

$ npm i elementsJS

Usage

If you used either npm or Bower, you can use the library as below:

//import the library CommonJS style
var elemsJS = require('elementsJS');
//use the elementsJS log() function
var foo = (bar, baz)=> {
	elemsJS.log(String(bar + baz < 100), 'blue', true);
};

foo(9, 99);

The above is a perfectly fine way to use elementsJS, however, the library was written in the spirit of making code more legible and perhaps, more aesthetically pleasing. That said, I reccomend using either EcmaScript 2015(es6)'s import functionality or a custom elementsJS imports() function to import the individual functions, so that the elements object doesn't need referencing every time a library function is used. See below:

ES2015:

//import the library's functions separately
import { log, err, el, dom, make, kill } from 'elementsJS';
/*use the elementsJS log() function, without referencing the
elements object*/
var foo = (bar, baz)=> {
    log(String(bar + baz < 100), 'blue', true);
    return (bar + baz < 100);
};
//use the dom() and log() functions
 if (foo(9, 99)) {
 	dom('#foobar')
 		.html('Hello!')
 		.color('blue')
 		.font('hack');

 	log('Confirmation.', '#090', true);
 }

elementsJS:

//import the imports() function from elementsJS
var imports = require('elementsJS').imports;
/*use the imports() function to import JS modules and their individual functions*/
imports({
     'lodash': ['omit', 'deburr', 'each', 'map'],
 'elementsJS': ['go', 'on', 'off', 'put', 'log', 'make'],
     'jQuery': '$'
});
//use any of the above functions without referencing the associated module object
var onGo = function() {
	make('#comment', 'input')
			.size('20px', '100px')
			.borderRadius('5px)
			.put('#footer');
}
go(onGo);

Both of these options, though require an additional compilation step. To use es6 functionality, code must be compiled with babel, and the elementsJS imports() function needs to be compiled using the elementsJS-interpreter. If you are using a build system such as gulp or grunt(coming soon), however, this step is a breeze (Click here to learn about using a build system in your development).

If you do decide to use the elementsJS imports() function, you can also try out the elements syntax, as the elementsJS-interpreter will parse your code for this syntax as well as the imports() function.

Click Here for the full API Documentation.