Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

parse-rect

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parse-rect - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

27

index.js

@@ -19,13 +19,25 @@ 'use strict'

}
else if (typeof arg === 'number') {
arg = [arg]
}
// 0, 0, 100, 100 - array-like
if (arg.length && typeof arg[0] === 'number') {
if (arg.length === 2) {
// [w, w]
if (arg.length === 1) {
rect = {
width: arg[0],
height: arg[0],
x: 0, y: 0
}
}
// [w, h]
else if (arg.length === 2) {
rect = {
width: arg[0],
height: arg[1],
x: 0,
y: 0
x: 0, y: 0
}
}
// [l, t, r, b]
else {

@@ -40,2 +52,3 @@ rect = {

}
// {x, y, w, h} or {l, t, b, r}
else if (arg) {

@@ -45,6 +58,6 @@ arg = pick(arg, {

top: 'y t top Top',
width: 'w width',
height: 'h height',
bottom: 'b bottom',
right: 'r right'
width: 'w width W Width',
height: 'h height W Width',
bottom: 'b bottom Bottom',
right: 'r right Right'
})

@@ -51,0 +64,0 @@

{
"name": "parse-rect",
"version": "1.1.1",
"version": "1.2.0",
"description": "Parse any input rectangle format",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -22,2 +22,6 @@ # parse-rect [![experimental](https://img.shields.io/badge/stability-unstable-green.svg)](http://github.com/badges/stability-badges) [![Build Status](https://travis-ci.org/dfcreative/parse-rect.png)](https://travis-ci.org/dfcreative/parse-rect)

parseRect([ 90, 80 ])
// {x: 0, y: 0, width: 90, height: 90}
parseRect(90)
parseRect([90])
```

@@ -24,0 +28,0 @@

@@ -19,1 +19,3 @@ 'use strict'

assert.deepEqual(parseRect([10, 20]), {width: 10, height: 20, x: 0, y: 0})
assert.deepEqual(parseRect(10), {width: 10, height: 10, x: 0, y: 0})
assert.deepEqual(parseRect([10]), {width: 10, height: 10, x: 0, y: 0})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc