芝麻web文件管理V1.00
编辑当前文件:/home/rejoandoctor/public_html/node_modules/collect.js/src/methods/median.js
'use strict'; module.exports = function median(key) { const { length } = this.items; if (key === undefined) { if (length % 2 === 0) { return (this.items[(length / 2) - 1] + this.items[length / 2]) / 2; } return this.items[Math.floor(length / 2)]; } if (length % 2 === 0) { return (this.items[(length / 2) - 1][key] + this.items[length / 2][key]) / 2; } return this.items[Math.floor(length / 2)][key]; };