aboutsummaryrefslogtreecommitdiff
path: root/lib/utils.js
blob: 2c3ce8b2d4ad8925391899b6d42b875237483b0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function atoi(str) {
	return parseInt(str, 10);
};

function chunkify(str) {
  var parts = [];
  var offset = 0;
  var length = str.length % 3 || 3;
  while (offset < str.length) {
    parts.push(str.substring(offset, offset + length));
    offset += length;
    length = 3;
  }
  return parts;
}

module.exports = {
	atoi: atoi,
	chunkify: chunkify,
};