Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including aspect-ratio with all npm packages installed. Try it out:

var aspectRatio = require("aspect-ratio")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

aspect-ratio v2.0.3

Get the screen aspect ratio of a device


Build Status Dependency status Dev Dependencies Status NPM Status Gittip

Get the aspect ratio of a device.


npm install aspect-ratio --save


with Node.js

const ratio = require('aspect-ratio')
console.log(ratio(1920, 1080)) // => 16:9
console.log(ratio(1920, 1080, '/')) // => 16/9

with CLI

$ aspect-ratio

  Get the screen aspect ratio of a device

    $ aspect-ratio <width><height>[options]

     -s      specified a separator. (by default is ':').
     --version   output the current version.

     aspect-ratio 1920 1080
     aspect-ratio 800 600 -s /


MIT © Kiko Beats

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free