Security News
NIST Misses 2024 Deadline to Clear NVD Backlog
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
shorter-js
Advanced tools
A small ES6/ES7 library with various JavaScript tools useful for creating light libraries.
A small ES6/ES7 library with various JavaScript tools useful for creating light libraries. Featured in KUTE.js, BSN and other libraries.
The purpose if the library is to speed up the development workflow, minimize the size of larger libraries by providing a shorter syntax for most used JavaScript API methods, most used strings or other helpful utilities.
While the library comes with a working build in the dist
folder, the main purpose of the library is mainly to be used in other libraries.
npm install shorter-js
// import the tool you need
import {on} from 'shorter-js'
// use the tool in your ES6/ES7 sources
on(elementTarget,eventName,eventHandler,options)
// EXAMPLES
import {addClass,removeClass,hasClass} from 'shorter-js'
// add a class
addClass(targetElement,'className')
// remove a class
removeClass(targetElement,'className')
// check for a class
if (hasClass(targetElement,'className')) {
myAction()
}
mousedown
, up: mouseup
touchstart
, end: touchend
, move: touchmove
, cancel: touchcancel
mouseenter
and mouseleave
OR mouseover
and mouseout
passive
event capabilityoptions
with passive: true event
option used// EXAMPLES
import {on,off,one,mouseEvents,touchEvents,passiveHandler} from 'shorter-js'
// attach a passive mousedown eventHandler
on(targetElement,mouseEvents.down,eventHandler,passiveHandler)
// detach a passive mousedown eventHandler
off(targetElement,mouseEvents.down,eventHandler,passiveHandler)
// attach a single instance passive mousedown eventHandler
one(targetElement,touchEvents.start,eventHandler,passiveHandler)
transform
transition
transitionend
event name supported by the client browsertransitionDuration
event property supported by the client browsertransitionDuration
property of a transition
propertytransitionend
event is triggered// EXAMPLES
import {on,supportTransitions,transitionEndEvent,emulateTransitionEnd} from 'shorter-js'
// check if client supports transitions
if (supportTransitions){
// attach transitionend handler
on(targetElement,transitionEndEvent,eventHandler,options)
} else {
eventHandler()
}
// the above should be equivalent to a much shorter
emulateTransitionEnd(targetElement,eventHandler)
FAQs
JavaScript shorties for the modern web.
The npm package shorter-js receives a total of 1,334 weekly downloads. As such, shorter-js popularity was classified as popular.
We found that shorter-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.