Cast width and height to integers

This commit is contained in:
Riley Shaw 2015-03-02 01:36:10 -05:00
parent 7087213c99
commit d62af6ec9c
3 changed files with 13 additions and 1 deletions

View File

@ -18,6 +18,12 @@ var dom = require('./dom.js');
*/
function Terrarium (width, height, options) {
var cellSize, neighborhood;
// cast width and height to integers
width = Math.ceil(width);
height = Math.ceil(height);
// set default options
options = options || {};
cellSize = options.cellSize || 10;
neighborhood = options.neighborhood || options.neighbourhood;

6
dist/terra.js vendored
View File

@ -322,6 +322,12 @@ var dom = require('./dom.js');
*/
function Terrarium (width, height, options) {
var cellSize, neighborhood;
// parse width and height as integers
width = Math.ceil(width);
height = Math.ceil(height);
// set default options
options = options || {};
cellSize = options.cellSize || 10;
neighborhood = options.neighborhood || options.neighbourhood;

2
dist/terra.min.js vendored

File diff suppressed because one or more lines are too long