New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

calc-aspect-ratio

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

calc-aspect-ratio

Calc aspect ratio for display resolutions

  • 1.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
125
decreased by-39.32%
Maintainers
1
Weekly downloads
 
Created
Source

calc-aspect-ratio

NPM version NPM downloads install size

Small package for calculating aspect ratio of display resolution.

Demo

Install

npm i --save-dev calc-aspect-ratio

Using

import { calcAspectRatio } from 'calc-aspect-ratio';

const aspectRatio = calcAspectRatio(1920, 1080);
console.log(aspectRatio);
/* console output:
    {
        x: 16,
        y: 9,
        value: '16:9',
        approximately: false,
        nonStandard: false
    }
 */

// or calc for current screen
console.log(calcAspectRatio(screen.width, screen.height).value);

Examples

  • Standard aspect ratio: 4:3
  • Approximate aspect ratio: ≈16:9
  • Nonstandard aspect ratio: 11.99:1

Keywords

FAQs

Package last updated on 22 Feb 2024

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