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

libj-globals

v1.1.2

Published

## Usage (npm) ``` npm install libj-globals ``` and on top of your entry point: ``` import 'libj-globals' ``` ### Adds jQuery symbols (`jQuery`, `$`), underscorejs (`_`) and moment (`moment`) symbols to `window` global variable, in order to use them anywh

Downloads

9

Readme

libj-globals

Part of libj tools

Usage (npm)

npm install libj-globals

and on top of your entry point:

import 'libj-globals'

Adds jQuery symbols (jQuery, $), underscorejs (_) and moment (moment) symbols to window global variable, in order to use them anywhere without importing them.

Also adds support for Jalaali calendar system to moment using moment-jalaali npm package.

For other type checkings See Underscorejs website

Adds these to underscore _ symbol

_.isVoid(value) -> boolean Is a function that if value is either null or undefined returns true, otherwise returns false. _.isJquery(value) -> boolean Checks if the given value argument is a jquery object _.isBuffer(value) -> boolean Checks if the given value argument is a Buffer object _.searchObjects(search, objects, properties = null) -> array of objects Searches for given search parameter in the give objects parameter. properties is an array of string which you can pass to limit searching an object to only these properties, if you don't pass this parameter or pass null all properties of an object will be searched. _.sortObjects(objects, columns) -> array of objects Sorts given objects according to given columns. columns is an array of { column: String, ascending: Boolean } in which 'column' is name of the name of property to sort and 'ascending' is a boolean for sorting direction based on that property.

Adds the following ECMA polyfills:

Adds the following for specific browser bugs:

  • classList for IE10 & IE11 See this
  • viewport fix for IE10 See this
  • maxlength attribute bug in many browsers

Adds these to window global variable for logging:

  • log function is a replacement for console.log and can be used globally. Usage:
log('test')   //prints test in console
  • stackTrace function is added globally to show current stack trace. Usage:
stackTrace()  //returns a string containing current stack trace
  • logStackTrace function is added globally to print stackTrace output to console. Usage:
logStackTrace() //prints current stack trace in console

Adds these to polyfill jquery in older browsers (Safari, IE):

  • $.fn.classes
  • $.fn.hasAttr checks if a jquery element contains an attribute. Calls $.fn.attr internally. Usage:
$('#someElementId').hasAttr('custom-attribute')
  • $.fn.equals checks if a given element equals another element. Usage:
$('#el1').equals($('#el1))    //returns true
  • $.fn.outerHTML returns outer html of the calling element. Usage:
<div id="el1">iii</div>
$('#el1').outerHTML()    //returns <div id="el1">iii</div>

Adds these to String prototype in borwsers:

  • format: Usage:
String.format("Hello %0. Welcome to %1", "Saeid", "libj")  //returns "Hello Saeid. Welcome to libj"

Adds these to Number prototype in browsers:

padZero`: Inserts specified number of zeros at the beginning of the calling number. Usage:

var x = 12;
x.padZero(4);    //returns "0012"