![Namecheap Takes Down Polyfill.io Service Following Supply Chain Attack](https://cdn.sanity.io/images/cgdhsj6q/production/6af25114feaaac7179b18127c83327568ff592d1-1024x1024.webp?w=800&fit=max&auto=format)
Security News
Namecheap Takes Down Polyfill.io Service Following Supply Chain Attack
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
2d-point
Advanced tools
Readme
Available as a node package. To install use
$ npm install 2d-point
The following methods are available.
Point.create(x, y)
Creates a frozen 2D point. Defaults to origin coordinate if no arguments given.
var Point = require('2d-point');
var pt = Point.create(2, 4);
// => {x: 2, y: 4}
var origin = Point.create();
// => {x: 0, y: 0}
Point.add(p, q)
Vector add two points returning a new point.
var p = Point.create(2, 3);
var q = Point.create(4, 5);
Point.add(p, q);
// => {x: 6, y: 8}
Point.subtract(p, q)
Vector subtract two points returning a new point.
var p = Point.create(2, 3);
var q = Point.create(4, 5);
Point.subtract(p, q);
// => {x: -2, y: -2}
Point.multiply(a, p)
Vector scalar multiply a point returning a new point.
var a = 3;
var p = Point.create(2, 3);
Point.multiply(a, p);
// => {x: 6, y: 9}
Point.fitWithin(container, vector)
Scales vector to fit just within the bounding box of the container point.
var container = Point.create(2, 2);
var landscape = Point.create(8, 4);
var portrait = Point.create(0.5, 1);
Point.fitWithin(container, landscape);
// => {x: 2, y: 1}
Point.fitWithin(container, portrait);
// => {x: 1, y: 2}
Point.fitWithin(container, vector)
Scales vector to fit just within on dimension of the bounding box of the container point.
var container = Point.create(2, 2);
var landscape = Point.create(8, 4);
var portrait = Point.create(0.5, 1);
Point.fitWithin(container, landscape);
// => {x: 4, y: 2}
Point.fitWithin(container, portrait);
// => {x: 2, y: 4}
FAQs
2D point object
The npm package 2d-point receives a total of 94 weekly downloads. As such, 2d-point popularity was classified as not popular.
We found that 2d-point 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
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.
Security News
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.