Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
20 lines
No EOL
445 B
JavaScript
Executable file
20 lines
No EOL
445 B
JavaScript
Executable file
define(function(require, exports, module) {
|
|
'use strict';
|
|
|
|
/**
|
|
* Returns aspect ratio string.
|
|
*
|
|
* Makes use of Euclid's GCD algorithm,
|
|
* http://en.wikipedia.org/wiki/Euclidean_algorithm
|
|
*
|
|
* @param {Number} w
|
|
* @param {Number} h
|
|
* @return {String}
|
|
*/
|
|
module.exports = function(w, h) {
|
|
var gcd = function(a, b) { return (b === 0) ? a : gcd(b, a % b); };
|
|
var divisor = gcd(w, h);
|
|
return (w / divisor) + ':' + (h / divisor);
|
|
};
|
|
|
|
}); |