Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
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.
dist
folder, that is mainly for build consistency testing.npm install shorter-js
// import the tool you need
import {supportTransform} from 'shorter-js'
// use the tool in your ES6/ES7 sources
if (supportTransform) {
doSomeAction()
}
perspective
transform
transition
passive
event option// EXAMPLES
import {support3DTransform} from 'shorter-js'
// filter myAction to supported browsers
if (support3DTransform) {
myAction()
}
// 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()
}
// EXAMPLES
import {on,off,one,passiveHandler} from 'shorter-js'
// attach a passive mousedown eventHandler
on(targetElement,'click',eventHandler,passiveHandler)
// detach a passive mouseup eventHandler
off(targetElement,'mouseup',eventHandler,passiveHandler)
// attach a single instance passive touchstart eventHandler
one(targetElement,'touchstart',eventHandler,passiveHandler)
transitionend
event is triggered, or execute the callback right after for legacy browserstransitionDuration
property of a transition
propertyoptions
with passive: true event
option used// EXAMPLES
import {queryElement,emulateTransitionEnd} from 'shorter-js'
// get some target
let targetElement = queryElement('.mySelectorClass');
// emulateTransitionEnd for the above
emulateTransitionEnd(targetElement,callback)
// check if element is in scroll range
// emulateTransitionEnd for the above
if (isElementInScrollRange(targetElement)){
doSomeAction()
}
mousedown
, up: mouseup
mouseenter
and mouseleave
OR mouseover
and mouseout
touchstart
, end: touchend
, move: touchmove
, cancel: touchcancel
transitionDuration
event property supported by the client browsertransitionend
event name supported by the client browser// EXAMPLES
import {on,off,one,mouseClickEvents,touchEvents,passiveHandler} from 'shorter-js'
// attach a passive mousedown eventHandler
on(targetElement,mouseClickEvents.down,eventHandler,passiveHandler)
// detach a passive mousedown eventHandler
off(targetElement,mouseClickEvents.down,eventHandler,passiveHandler)
// attach a single instance passive touchstart eventHandler
one(targetElement,touchEvents.start,eventHandler,passiveHandler)
To avoid adding un-necessary shorties into your code, you might want to import them directly from their location
// Example
import {on} from 'shorter-js/src/event/on.js'
import {addClass} from 'shorter-js/src/class/addClass.js'
FAQs
JavaScript shorties for the modern web.
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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.