How to get the closest iBeacon?

Hi guys, currently I’m working with iBeacons and by far have managed to scan and display them on screen. But then I was told to scan and display for ONLY the nearest one ( the closest one), and ignore all the others. Can someone give me a rough idea how to get the closest beacon among a bunch of beacons that I have?

Basically I haven;t figured out how to work with the logic:

onBeaconsDiscovered() {
    this.delegate.didRangeBeaconsInRegion().subscribe( data => {
      if (data.beacons !== null) {
        let nearestBeacon = // { code for detecting the nearest beacon }

        // then show up a notification / alert / toast ...


IMO I can’t use the Proximity and Accuracy in this case since they often fluctuate.

Please help! I appreciate every idea.