
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
Calculates the size and the position of a target to fit a container, adjusted to keep a focus point
Calculates the size and the position of a target to fit a container, adjusted to keep a focus point
A mix of jquery-focuspoint and math-fit
npm i math-cover
var cover = require('math-cover')
var target = {
w: 200,
h: 100
}
var parent = {
w: 100,
h: 200
}
// {left: -150, top: 0, width: 400, height: 200, scale: 2, position: '50% 50%'}
var obj = cover(target, parent)
Params x and y are ratio of target.w and target.h and must be 0 <= ratio <= 1
var cover = require('math-cover')
var target = {
w: 200,
h: 100,
x: .2,
y: .2
}
var parent = {
w: 100,
h: 200
}
// {left: -30, top: 0, width: 400, height: 200, scale: 2, position: '10% 50%'}
var obj = cover(target, parent)
npm i && npm start
| Keydown | Action |
|---|---|
| w | random width |
| h | random height |
| u | random width + height |
| i | random image |
| d or space | toggle debug |
Mainly forked / inspired on jquery-focuspoint and math-fit
MIT
FAQs
Calculates the size and the position of a target to fit a container, adjusted to keep a focus point
We found that math-cover 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
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.