Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
breakdancer
Advanced tools
Breakdancer is a small utility library that helps developing and using ergonomic breakpoints. Devices and sizes will always change, human ergonomics like palm, wrist, lap, desk, wall never will.
The module is released in the public npm registry and can be installed by running the following command in your terminal:
npm install --save breakdancer
Please do note that:
The Breakdancer
constructor is exported as default interface of this module
and can be imported using:
import Breakdancer from 'breakdancer';
The Breakdancer
constructor accepts 2 arguments which are your specification
ergonomic or just breakpoints and an optional reference to a custom window
object which should be used for view port information. The specification can
either be an object where the key of the object is name and the value the
width/height specification or an array of object where the objects have a name
property.
var breakpoints = new Breakdancer([
{
name: 'wrist',
width: 320
},
{
name: 'palm',
width: 800,
heigt: 600
}
]);
The width
and/or height
that you specified should be seen as a minimum value.
So when you specify 320 as width for wrist that means that 0 - 319 will trigger
as wrist
breakpoint. If width and height are both set it needs to satisfy
the minim value of height as well before our checks move to the next
breakpoint.
Now that everything is specified we can look at which methods are exposed on the created instance. In all examples we assume that the code above is used as example.
Returns the width of the current view port.
breakpoints.width() // 390
Returns the height of the current view port.
breakpoints.height(); // 509
Returns both the height and width of the current view port as an object.
breakpoints.viewport() // { width: 390, height: 509 }
Check if the view port and therefor our specified breakpoints have changed since
the last time we've called the changed
method. When constructing an instance
we automatically check what our current satisfied breakpoint is. This method
returns a boolean as indication if a change has occurred.
breakpoints.changed() // false
.. resize the browser ..
breakpoints.changed() // true
The method accepts an optional viewport argument if you want to test a different
viewport configuration. If none is provided it will use the viewport information
from the .viewport()
method.
Calculates what we're currently triggering as view port. It does by iterating over the specified breakpoints and see if they are satisfying in the current view port. The name of the triggered breakpoint is returned as string.
breakpoints.currently(); // desktop
The method accepts an optional viewport argument if you want to test a different
viewport configuration. If none is provided it will use the viewport information
from the .viewport()
method.
A cached value that is used to see if the breakpoint is changed. This is updated
when the .changed()
method is called. So it's advised to use .changed()
and
.breakpoint
over manually calling the .currently()
method for figuring out
the current break point.
console.log(breakpoints.breakpoint) // wrist
breakpoints.changed();
console.log(breakpoints.breakpoint) // palm
3.0.0 (2.0.0 was skipped due to previously being published)
FAQs
A breakpoint tracking utility
The npm package breakdancer receives a total of 17 weekly downloads. As such, breakdancer popularity was classified as not popular.
We found that breakdancer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 16 open source maintainers 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
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.