Files
stf-DeviceFarmer-1/lib/util/cliutil.js
2015-10-14 01:56:30 +09:00

18 lines
362 B
JavaScript

module.exports.list = function(val) {
return val.split(/\s*,\s*/g).filter(Boolean)
}
module.exports.size = function(val) {
var match = /^(\d+)x(\d+)$/.exec(val)
return match ? [+match[1], +match[2]] : undefined
}
module.exports.range = function(from, to) {
var items = []
, i
for (i = from; i <= to; ++i) {
items.push(i)
}
return items
}