111
k94314517
2024-01-31 5bce819f4a418f9ae352eb105e33707de1e0c1ce
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// 去空
export function trim (data) {
  if (data == null) {
    return null
  }
  if (typeof data === 'string') {
    return data.trim()
  }
  if (data instanceof Array) {
    for (const item of data) {
      trim(item)
    }
  }
  if (typeof data === 'object') {
    for (const key in data) {
      data[key] = trim(data[key])
    }
  }
  return data
}