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

cms7-underscore

v1.0.5

Published

- ### _: which is a shortcut for import _ from 'underscore'

Downloads

3

Readme

underscore extensions

Adds following variables to window variable:

  • _: which is a shortcut for import _ from 'underscore'

Exports:

  • isVoid function(value) -> Boolean: checks if the value is either null or undefined

    isVoid(null) returns: true

  • isJquery function(value) -> Boolean: checks if the value is an instance of jQuery

    isJquery($('.test')) returns: true

  • toJquery function(value) -> jQuery: if the value is not a jQuery instance, assumes that value is a jquery selector and returns the jquery instance of that selector

    toJquery($('.test')) returns: $('.test') variable toJquery('.test') returns: $('.test') variable

  • callSafe function(func) -> return value of func: calls the given function if it is available

  • guid function() -> String: returns a c# Guid.NewGuid().ToString("N") like string

    guid() returns: 976edaa0d2464573a6ea01aabaa98899

  • newId function() -> String: returns guid() plus a prefix to make it suitable for html id attributes

    newId() returns: e_976edaa0d2464573a6ea01a4bca98899

  • kebab_case_to_camelCase function(kebabCase) -> String: converts kebab-case string into camelCase equivalent

    kebab_case_to_camelCase('cms7-underscore') returns: cms7Underscore

  • containsArabic function(value) -> Boolean: checks if a string contains persian or arabic characters

  • isKeyAlphaNumeric function(keyCode) -> Boolean: checks if the given keyCode of a jquery's keyup or keydown events is either digit or letter

  • isKeyTextInput function(keyCode) -> Boolean: checks if the given keyCode of a jquery's keyup or keydown events is either digit or letter and is NOT backspace: 8 nor delete: 46

  • spinLock class(locked: func, unlocked: func):

    • methods:

      • lock() -> void: locks the object
      • unlock() -> void: unlocks the object
      • isLocked() -> Boolean: tells if the object is locked
      • waitForLock(callback: func) -> void: invokes the callback asynchronously when the object is unlocked
  • render function(template: String, data: Object) -> String: renders a template using the data as its model with underscorejs template engine

  • culture function(culture) -> String: sets or gets current culture

  • dir function(culture) -> String: gets current direction based on the given culture or current culture (if culture is null)

  • cultures function(cultures) -> Array: sets or gets current allowed cultures

  • xsrfHeaderName function(xsrfHeaderName) -> String: sets or gets current XSRF header name

  • xsrfValue function(containerSelector, tagName) -> String: sets or gets current XSRF value

  • googletMapApiKey function(apiKey) -> String: sets or gets current google map api key

  • googleAnalyticsId function(gaid) -> String: sets or gets current google analytics id

  • calendar function() -> calendars: gets current calendar based on current culture

  • newDat function(calendar, year, month, day, hour = 0, minute = 0, second = 0, millisecond = 0) -> dat: creates a new dat

  • dateTimeFormats:

    all: "year-month-day-hour-minute-second-millisecond", ymdhms: "year-month-day-hour-minute-second", ymdhm: "year-month-day-hour-minute", ymdh: "year-month-day-hour", ymd: "year-month-day", ym: "year-month", y: "year", hmsm: "hour-minute-second-millisecond", hms: "hour-minute-second", hm: "hour-minute", h: "hour"
  • calendars:

    gregorian: moment, jalaali: jmoment, hijri: imoment
  • dat: dat class for date-time operations

  • registerXsrfHeaderInAjaxPost function() -> void: registers current xsrfHeaderName and xsrfValue in ajax-post

  • createUrl function(url) -> String: gets localized url

  • createAjaxOptions function(method, url, data, success, error, completed) -> jQuery ajax options

  • send function(method, url, data, success, error, completed) -> void

  • sendGet function(url, data, success, error, completed) -> void

  • sendPost function(url, data, success, error, completed) -> void

Adds the above methods to any underscore variable:

for example _.isVoid, _.isJquery, ...