summaryrefslogtreecommitdiffstats
path: root/examples/declarative/places/content/places/PlacesUtils.js
blob: 756deb99fa001477f8a36440a16088ec012c1c57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
.pragma library

function prettyDistance(distance) {
    if (distance < 1000)
        return distance.toFixed(0) + "m";

    var km = distance/1000;
    if (km < 10)
        return km.toFixed(1) + "km";

    return km.toFixed(0) + "km";
}