Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
A helper to work with rectangular regions in the DOM
$ npm install region --save
var Region = require('region')
var region = Region({
top: 10,
left: 10,
width: 50,
height: 60
})
region.getRight() == 60
region.getBottom() == 70
You can create a new Region by calling the function returned by require('region')
. You can call it as a constructor if you want.
var Region = require('region')
new Region({
top: 10,
left: 10
//either width,height
//or right, bottom
width: 10,
height: 10
})
or
var Region = require('region')
var r = Region({
top: 10,
left: 10,
right: 20,
bottom: 20
})
You can instantiate a Region
from a DOM node, using Region.fromDOM (NOTE: uses dom.offsetWidth/Height/Left/Top for getting coordinates)
var r = Region.fromDOM(document.body)
var r = Region({
top: 10,
left: 10,
width: 10,
height: 10
})
r.containsPoint(15, 10) == true
r.containsPoint({x: 10, y: 10}) == true
Returns true if this region equals the region (or the object) given as the first param var r = Region({top: 10, left: 10, bottom: 20, right: 20 })
r.equals({top: 10, left: 10, bottom: 20, right: 20 }) == true
Returns true if this region has top, left equal to the given coordinates
Returns true if this region has the same size as the given region or object
var coords = { top: 10, left: 10, width: 100, height: 100 }
var r = Region(coords)
r.equalsSize(coords) == true
r.equalsSize(r.clone()) == true
Returns the region resulted by intersecting this region with the given region. If no intersection, returns false
Returns a new region instance with the same coordinates
var r = new Region({left: 10, right: 10, width: 10, height: 20})
r.clone().equals(r)
$ make
Watch mode
$ make test-w
MIT
FAQs
A helper to work with rectangular regions in the DOM
We found that region 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.