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

sujits

v1.0.2

Published

This is just Some Useful Javascript utlITieS (sujits)

Downloads

14

Readme

README

This is just Some Useful Javascript utlITieS (sujits); sorry, I am not very creative, that have helpled me. All have been found on Stack Overflow.

Why sujits?

Mainly because I found myself needing to write these utilities over and over again so I figured why not just package them.

Installation

npm i --save sujits

Usasge

Browser Utilities

getQuerystring

sujits.getQuerystring('monkey');
  • When run in the browswer will return the value in the query string of the url.

setBrowserClass

sujits.setBrowserClass();
  • When run in the browswer will return: is-chrome, is-firefox, is-safari, is-ie, is-ie-edge, is-opera

isMobileOS

sujits.isMobileOS();
  • detectMobileOS() => false //If on desktop;
  • detectMobileOS() => true; //If OS is one of the provided agents in the list: 'Android', 'webOS', 'iPhone', 'iPad', 'iPod', 'BlackBerry', 'Windows Phone',

Detect Sizes

You can pass in the an optional paramater of breakpoint size for each of these size detectors.

isMobile

sujits.isMobile();
  • Will tell you if your value is in the mobile bounds.
  • Default is set to 640 based on foundation grid breakpoints.

detectTabletSize

Can take two optional paramaters one for mobile breakpoint (default set to 640) and one for desktop breakpoint (default set to 1024).

sujits.detectTabletSize();

isTabletDown

Will tell you if your value is in or below tablet bounds. Default is set to 1024.

sujits.detectTabletDown();
  • Will tell you if your value is in or below tablet bounds.

isDesktop

sujits.isDesktop();
  • Will tell you if your value is in desktop bounds.
  • Default is set to 1025 as this is tablet breakpoint.

General help utilities

ordinalSuffix

sujits.ordinalSuffix(2); // 2nd

This will will take a number and return you the suffix such as 1st when you pass in a 1 and 2nd when you pass in a 2 etc.

closest

sujits.closest('.classname');

These resemble jquery's closest functions which comes in very handy when trying to traverse the dom in vanillaJS

delay

sujits.delay();

A delay function useful for search as you type functionality in that the user can type a few leters before it fires off.