mirror of https://github.com/pelias/api.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
376 B
21 lines
376 B
9 years ago
|
/**
|
||
|
* Utility for calculating query result size
|
||
|
* incorporating padding for dedupe process
|
||
|
*/
|
||
|
|
||
|
var SIZE_PADDING = 2;
|
||
|
|
||
|
/**
|
||
|
* Add padding or set to 1
|
||
|
*
|
||
|
* @param {number} cleanSize
|
||
|
* @returns {number}
|
||
|
*/
|
||
|
module.exports = function calculateSize(cleanSize) {
|
||
|
switch (cleanSize || 1) {
|
||
|
case 1:
|
||
|
return 1;
|
||
|
default:
|
||
|
return cleanSize * SIZE_PADDING;
|
||
|
}
|
||
|
};
|