0.1.5 • Published 10 years ago

bestfit v0.1.5

Weekly downloads
9
License
-
Repository
github
Last release
10 years ago

bestfit build status

testling badge

Finds image rendition that best fits a given container.

var bestfit = require('bestfit');

var renditions = [
  { width: 2 ,height: 1, id: 0 }
, { width: 3 ,height: 1.5, id: 1 }
, { width: 1 ,height: 0.5, id: 2 }
, { width: 4 ,height: 2, id: 3 }
];

var fn = bestfit(renditions);
fn(2, 1.5);

Output

{ width: 3,
  height: 1.5,
  id: 1,
  widthPercentage: 1.5,
  heightPercentage: 1 }

Installation

npm install bestfit

API

generated with docme

License

MIT

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago