Dejvino's Curriculum Vitae
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

12345678910
  1. export function partition<T>(array: T[]|undefined, entriesPerRow: number): T[][] {
  2. return array ? array.reduce((accumulator: T[][], current: T, index) => {
  3. if (index % entriesPerRow == 0) {
  4. accumulator[accumulator.length] = [current]
  5. } else {
  6. accumulator[accumulator.length - 1]
  7. }
  8. return accumulator
  9. }, []) : []
  10. }