Open XinChou16 opened 5 years ago
result.sort(function (a, b) {
if (a[0] < b[0]) {
return -1
}
if (a[0] > b[0]) {
return 1
}
if (a[0] === b[0]) {
if (b[1].indexOf('.webp', b[1].length - 5) !== -1) {
return 1
}
if (a[1].indexOf('.webp', a[1].length - 5) !== -1) {
return -1
}
}
return 0
})
https://github.com/hilongjw/vue-lazyload/blob/master/src/util.js
风格指南 https://github.com/lin-123/javascript#functions
隐藏类型转换
https://github.com/lin-123/javascript#comparison-operators--equality
15.7 避免不需要的三元表达式