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

tools-clickwithclark

v1.5.1

Published

A bunch of useful tools to complement any web dev project

Downloads

7

Readme

Table of Contents

addFontFace

Dynamically add Fonts to a Page

Additional Notation

Parameters

  • families Array An array list of google font families to add to a page.

Examples

//Font Style

n: normal  (default)
i: italic
o: oblique


(no properties)
=> n4

font-style: italic;
=> i4

font-weight: normal;
=> n4

font-weight: bold;
=> n7

font-style: normal;
font-weight: 400;
=> n4

font-style: italic;
font-weight: 500;
=> i5

//usage:

addFontFace(['Praise:400','Montserrat:400,700,i4,i7','Roboto:i5'])

createElement

Easily Create HTML elements

Remember: 'className' for classes not just 'class'

Original Author

Parameters

  • object Object The object to build the HTML element

Examples

document.body.appendChild(createElement({
type:'section',
className:'secion-1', 
id:'section-1-id',
innerHTML:'This is an Example',
attributes:{
dataFoo:'data Test 1',
dataBaz:'data Test 2',
onclick:'someFuncHere(this);'
}
}))

debounce

Delays invoking a callback function until after the timeout seconds have elapsed since the last time the debounced function was invoked

Parameters

  • callback @callback function to execute
  • timeOut Number delay time in seconds

debounceInput

Debounce a given input

Parameters

  • callback @callback function to execute
  • doneTypingInterval Number delay time in seconds

debounceLeading

Run callback once and ignore subsequence calls within given timeOut good for triggering auto-save or displaying suggestions

Parameters

  • callback @callback function to execute
  • timeout Number delay time in seconds

throttle

Invokes callback at most once per every timeOut seconds.

Parameters

  • callback @callback function to execute
  • timeOut Number delay time in seconds

deepCopy

Copies an object and all it's nested properties

More Info: MDN Web Docs

Parameters

  • object Object The object to copy

Returns Object The copied object

escapeHtml

Prevent accidental markup where text is expected

Parameters

  • text String The text to be escaped

Returns String The escaped text with no HTML markup

generateID

Generate an alphanumeric unique ID No duplicates found in a 10 Million ID generation test Ideal for small prototypes/scenarios.

For serious commercial projects use nanoid.

Parameters

Returns String A unique ID

toLowerKeys

Converts an object's keys to lower case

Parameters

  • obj Object Object with possible mixed keys

Returns Object

waitForElement

Parameters

  • selector String The selector of the desired element
  • checkFrequencyInMs Number How often to check for element in Milliseconds
  • timeoutInMs Number How long to keep checking in milliseconds before timing out

Examples

//Here it is waiting on an element by class name for 10 seconds, and checking every half a second for the element

waitForElement('.vsc-initialized',500,10_000).then((e)=>{console.log('element found'); return e;})

Returns Promise Resolves to the element if found

Webpack Configs

Usage

First Install the package to get access to all the dependencies

npm i tools-clickwithclark

Then call the package with the desired flag

npx tools-clickwithclark < wp | webpack> [option] <'path/to/main.js'> | default ='./src/index.js'

Options

-p, --prod : Production Configurations

-d, --dev : Development build Configurations

-u, --umd : UMD build Configurations

-b, --obf : Obfuscated build Configurations

Example

npx --yes tools-clickwithclark wp -u './index.js'
npx --yes tools-clickwithclark wp -p './index.js'
npx --yes tools-clickwithclark wp -d './index.js'
npx --yes tools-clickwithclark wp -b './index.js'