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

@dvlden/aspecter

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dvlden/aspecter

A utility module for Node & Browser that calculates aspect ratio and decimal fraction based on width and height and alongside provides normalized aspect.

  • 1.0.8
  • latest
  • Source
  • npm
  • Socket score

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

Aspecter

A utility module for Node & Browser that calculates aspect ratio and decimal fraction based on width and height and alongside provides normalized aspect.

The normalizedAspect result contains information for intended aspect ratio of that resolution. Many film/video creators do rendering at some weird resolutions, so normalized aspect will be the intended choice.


Installation (pick one)

  • npm i @dvlden/aspecter
  • pnpm i @dvlden/aspecter
  • yarn add @dvlden/aspecter

Usage

You may hard-code width/height or grab it from some source. (e.g. video, image) If you have some weird resolution, normalizedAspect should be what you're actually looking for.


TypeScript

import { aspecter } from '@dvlden/aspecter'

const aspecterResult = aspecter(1280, 536)

Node

const { aspecter } = require('@dvlden/aspecter')

const aspecterResult = aspecter(1280, 536)

Browser

<!-- PENDING CDN SUBMISSIONS -->
<script src="path/to/aspecter.js"></script>
<script>
  const aspecterResult = aspecter(1280, 536)
</script>

Output

Same resolution was used in all examples above, so the result will be the same.

// -- console.log output --
{
  resolution: [1280, 536],
  originalAspect: {
    ratio: [160, 67],
    decimal: 2.38
  },
  normalizedAspect: {
    ratio: [21, 9],
    decimal: 2.33
  }
}

Keywords

FAQs

Package last updated on 22 Jan 2023

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