npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

area-man

v0.3.6

Published

a simple utils lib for handling areas

Downloads

1

Readme

Area Manager

A simple utils library for handling areas. Create, move, reflect, scale, squash etc

Install:

Area Man is available as the area-man package on npm.

npm install area-man --save

Usage

var AreaMan = require('area-man');

You can use ES6 imports too:

import {Area}} from 'area-man';

const area = new Area(params);

AreaMan.newArea(params [,id])

Creates a new area.

params: object

Needs the properties x, y, width, height or x1, y1, x2, y2.

id: string

Optional id if you want to be able to retrieve an area later (WIP).

returns: Area

Area.width | height

Get or set the area's width or height

returns: [number]

Area.isWide | isTall | isSquare

compare width and height to tell is an area is taller than it is wide

returns: [boolean]

Area.area

calculate the area's surface area

returns: [number]

Area.centrePoint

TODO

Area.move(x: number = 0, y: number = 0)

Translate the area by x, y

returns: Area

Area.shrink(adjustments: number | [number, number, number, number])

Area.grow(adjustments: number | [number, number, number, number])

Shrink or grow the area, removing the given values from each side. If a single value is provided then all sides will be adjusted equally.

returns: Area

Area.scale(scale: number, originX: number, originY: number)

Scale an area.

returns: Area

Area.squash(squashDirection: string, percentage: number, originX: number, originY: number)

Squash an area, changing its size but keeping its surface area the same.

params: squashDirection

Specify "horizontal" or "vertical"

params: percentage

How much to squash the area as a percentage of its current size.

params: originX originY`

Origin point for the squash relative to the area. 0,0 is the top-left corner, 1,1 is bottom-right.

returns: Area

Area.reflect(reflectX: boolean, reflectY: boolean, originX: number, originY: number)

Reflect an area.

returns: Area

Area.clone(id?: string)

Clone an area.

returns: Area

Area.split(sliceDirection: string, percentage: number, clone: boolean = true)

Split an area in two. The default is to clone the source area and keep the original unchanged, but you can override this to affect the original area if needed.

returns: Area

Area.hitTest(areas: IArea | IArea[])

Test whether an area (or any of a list of areas) overlap a target area.

returns: boolean

TODO

  • comprehensive documentation
  • better demo page
  • more operations
  • different shapes