Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
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
The npm package region receives a total of 7,792 weekly downloads. As such, region popularity was classified as popular.
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.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.