function transformNumberToArray(newValue) {
    newValue = newValue.trim();
    const wordArray = newValue.split(' ');
    const number = wordArray[wordArray.length - 1];
    const arr = [];

    if (/^\d+$/.test(number)) {
        for (let i = 1; i < +number + 1; i++) {
            arr.push(i);
        }
        newValue = newValue.replace(number, `[${arr}]`);
    }

    return newValue;
}
function transformNumberToArray(newValue) {
    newValue = newValue.trim();
    const wordArray = newValue.split(' ');
    const number = wordArray[wordArray.length - 1];
    const arr = [];

    if (/^\d+$/.test(number)) {
        for (let i = 1; i < +number + 1; i++) {
            arr.push(i);
        }
        newValue = newValue.replace(number, `[${arr}]`);
    }

    return newValue;
}
function transformNumberToArray ( newValue ) { newValue = newValue . trim ( ) ; const wordArray = newValue . split ( ' ' ) ; const number = wordArray [ wordArray . length - 1 ] ; const arr = [ ] ; if ( / ^\d+$ / . test ( number ) ) { for ( let i = 1 ; i < + number + 1 ; i ++ ) { arr . push ( i ) ; } newValue = newValue . replace ( number , ` ${ arr } ` ) ; } return newValue ; }
转化数字为数组，以支持for="item in 5"语法

@param {string} newValue 待转化的字符串
@return {string} 被转化后的数组字符串
转化数字为数组，以支持for = item in 5 语法