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

@ludovicm67/simple-js

v1.0.1

Published

A simple JavaScript library

Downloads

7

Readme

simpleJS : A simple JavaScript library

simpleJS (or sJS) is a small and very useful library for JavaScript.

Demo here: https://simple-js.ludovicm67.fr/

If you want to get out from the heavy jQuery world, this is one of the best library for you, because your jQuery code like:

$.ajax({
  type: "POST",
  url: "/my/url",
  async: true,
  data: data,
});

will be something like

sJS.ajax({
  type: "POST",
  url: "/my/url",
  async: true,
  data: data,
});

So here in this case, only the '$' was transformed to 'sJS'

So you will be familiar with the requests. But simpleJS is not only for people from jQuery; this library will only contain the most useful tools for JavaScript developers with the help of the community. Everyone can read and improve this code, because it's easy to read and to add new components.

simpleRequest

With sJS, you can perform classics requests like in jQuery, but also in this way:

sJS.get("/my/url", function (err, res) {
  if (!err) {
    // no errors, so let's so something
  } else {
    // Oh no ! An error ! Let's do something else
  }
});

So you can choose the syntax you prefer :wink:

The code is very easy to understand and not long, so if you want to learn more about all what you can do with sJS requests, you can see the code in the js/components/ folder.

simpleElements

You can also create new elements in an easy way

document.appendChilds(
  sJS.newElem("p", {
    className: "test",
    textContent: "This is a paragraph for a test :p",
  }),
  sJS.newElem("div", {
    id: "myId",
    innerHTML: "Hello world ! :)",
  })
);

instead of

var p = document.createElement("p");
p.className = "test";
p.textContent = "This is a paragraph for a test :p";

var div = document.createElement("div");
div.id = "myId";
div.innerHTML = "Hello world ! :)";

var body = document.getElementsByTagName("body")[0];
body.appendChild(p);
body.appendChild(div);

So here you can see that :

  • we added the appendChilds() method

  • you can create HTML elements very quickly with sJS.newElem('tag', params)

You can also :

  • remove elements quickly by using : element.remove()

  • remove elements by using : sJS.removeElem(elementsToDelete)

simpleInfos

It adds some informations about the project, so just type sJS.printInfos() and watch the console.

It can be useful, when you find a problem, and need to find the original repository to open an issue and/or to contribute in other ways.

This component is very small, so if you want to add a new one, just copy this one, remove special content and add your stuff!

Bugs?

This library is very young, so it might not be perfect for the moment.

You can fork and contribute to this repository by correcting some bugs or adding new components, or just open an issue here https://github.com/ludovicm67/simple-js/issues :wink: