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

Parse any input rectangle format

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
187K
increased by1.89%
Maintainers
1
Weekly downloads
 
Created
Source

parse-rect experimental Build Status

Take any rectangle-like argument and return rectangle values.

npm install parse-rect

const parseRect = require('parse-rect')

// {x: 10, y: 20, width: 90, height: 80}
parseRect('10 20 100 100')
parseRect(10, 20, 100, 100)
parseRect([10, 20, 100, 100])
parseRect({ x: 10, y: 20, width: 90, height: 80 })
parseRect({ x: 10, y: 20, w: 90, h: 80 })
parseRect({ l: 10, t: 20, r: 100, b: 100 })
parseRect({ left: 10, top: 20, right: 100, bottom: 100 })

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

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

License

(c) 2018 Dmitry Yv. MIT License

Keywords

FAQs

Package last updated on 19 Mar 2018

Did you know?

Socket

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.

Install

Related posts

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