react-native-svg
Version:
SVG library for react-native
15 lines (13 loc) • 438 B
JavaScript
const spaceReg = /\s+/;
const commaReg = /,/g;
export default function (lengthList) {
if (typeof lengthList === 'string') {
return lengthList.trim().replace(commaReg, ' ').split(spaceReg);
} else if (typeof lengthList === 'number') {
return [`${lengthList}`];
} else if (lengthList && typeof lengthList.map === 'function') {
return lengthList.map(d => `${d}`);
} else {
return [];
}
}