UNPKG

476 BJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = getWidths;
7function getWidths(optionalWidthString) {
8 if (!optionalWidthString || optionalWidthString === '') {
9 return [];
10 }
11
12 if (!/^[0-9,]*$/.test(optionalWidthString)) {
13 throw new Error('Widths must be comma seperated integers. Received: ' + optionalWidthString);
14 }
15
16 return optionalWidthString.split(',').map(function (s) {
17 return parseInt(s, 10);
18 });
19}
\No newline at end of file