
Research
Node.js Fixes AsyncLocalStorage Crash Bug That Could Take Down Production Servers
Node.js patched a crash bug where AsyncLocalStorage could cause stack overflows to bypass error handlers and terminate production servers.
rectangle-decomposition
Advanced tools
Computes an optimal rectilinear decomposition. Based on the bipartite matching algorithm. References:
This code is 100% JavaScript and works in both node.js and in a browser via browserify.
var decompose = require("rectangle-decomposition")
//First create a region:
//
// *-----*
// | |
// *-* |
// | |
// | *-* |
// | | | |
// | *-* |
// | |
// *-------*
//
//Regions are defined by lists of loops, default oriented counter clockwise
//
var region = [
[[1,1], [1,2], [2,2], [2,1]],
[[0,0], [4,0], [4,4], [1,4], [1,3], [0,3]]]
//Next, extract rectangles
//
var rectangles = decompose(region)
console.log(rectangles)
//Prints out:
//
// [ [ [ 1, 0 ], [ 2, 1 ] ],
// [ [ 0, 0 ], [ 1, 3 ] ],
// [ [ 2, 0 ], [ 4, 4 ] ],
// [ [ 1, 2 ], [ 2, 4 ] ] ]
//
//Equivalent to the following decomposition:
//
// *-----*
// | ! |
// *-* ! |
// | ! ! |
// | *-* |
// | | | |
// | *-* |
// | ! ! |
// *-------*
//
npm install rectangle-decomposition
require("rectangle-decomposition")(loops[,clockwise])Decomposes the polygon defined by the list of loops into a collection of rectangles.
loops is an array of loops vertices representing the boundary of the region. Each loop must be a simple rectilinear polygon (ie no self intersections), and the line segments of any two loops must only meet at vertices. The collection of loops must also be bounded.clockwise is a boolean flag which if set flips the orientation of the loops. Default is true, ie all loops follow the right-hand rule (counter clockwise orientation)Returns A list of rectangles that decompose the region bounded by loops into the smallest number of non-overlapping rectangles.
(c) 2014 Mikola Lysenko. MIT License
FAQs
Minimal decomposition of rectilinear polygons into rectangles
We found that rectangle-decomposition 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
Node.js patched a crash bug where AsyncLocalStorage could cause stack overflows to bypass error handlers and terminate production servers.

Research
/Security News
A malicious Chrome extension steals newly created MEXC API keys, exfiltrates them to Telegram, and enables full account takeover with trading and withdrawal rights.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.