zet-lib 1.2.101 → 1.2.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Util.js +35 -0
- package/lib/moduleLib.js +6 -0
- package/package.json +1 -1
package/lib/Util.js
CHANGED
|
@@ -1275,4 +1275,39 @@ Util.decrypt = (str, key) => {
|
|
|
1275
1275
|
return s + decrypt.final('utf8')
|
|
1276
1276
|
}
|
|
1277
1277
|
|
|
1278
|
+
Util.terbilang = (nilai) => {
|
|
1279
|
+
nilai = Math.floor(Math.abs(nilai))
|
|
1280
|
+
let huruf = ['', 'Satu', 'Dua', 'Tiga', 'Empat', 'Lima', 'Enam', 'Tujuh', 'Delapan', 'Sembilan', 'Sepuluh', 'Sebelas']
|
|
1281
|
+
let bagi = 0
|
|
1282
|
+
let penyimpanan = ''
|
|
1283
|
+
if (nilai < 12) {
|
|
1284
|
+
penyimpanan = ' ' + huruf[nilai]
|
|
1285
|
+
} else if (nilai < 20) {
|
|
1286
|
+
penyimpanan = terbilang(Math.floor(nilai - 10)) + ' Belas'
|
|
1287
|
+
} else if (nilai < 100) {
|
|
1288
|
+
bagi = Math.floor(nilai / 10)
|
|
1289
|
+
penyimpanan = terbilang(bagi) + ' Puluh' + terbilang(nilai % 10)
|
|
1290
|
+
} else if (nilai < 200) {
|
|
1291
|
+
penyimpanan = ' Seratus' + terbilang(nilai - 100)
|
|
1292
|
+
} else if (nilai < 1000) {
|
|
1293
|
+
bagi = Math.floor(nilai / 100)
|
|
1294
|
+
penyimpanan = terbilang(bagi) + ' Ratus' + terbilang(nilai % 100)
|
|
1295
|
+
} else if (nilai < 2000) {
|
|
1296
|
+
penyimpanan = ' Seribu' + terbilang(nilai - 1000)
|
|
1297
|
+
} else if (nilai < 1000000) {
|
|
1298
|
+
bagi = Math.floor(nilai / 1000)
|
|
1299
|
+
penyimpanan = terbilang(bagi) + ' Ribu' + terbilang(nilai % 1000)
|
|
1300
|
+
} else if (nilai < 1000000000) {
|
|
1301
|
+
bagi = Math.floor(nilai / 1000000)
|
|
1302
|
+
penyimpanan = terbilang(bagi) + ' Juta' + terbilang(nilai % 1000000)
|
|
1303
|
+
} else if (nilai < 1000000000000) {
|
|
1304
|
+
bagi = Math.floor(nilai / 1000000000)
|
|
1305
|
+
penyimpanan = terbilang(bagi) + ' Miliar' + terbilang(nilai % 1000000000)
|
|
1306
|
+
} else if (nilai < 1000000000000000) {
|
|
1307
|
+
bagi = Math.floor(nilai / 1000000000000)
|
|
1308
|
+
penyimpanan = terbilang(nilai / 1000000000000) + ' Triliun' + terbilang(nilai % 1000000000000)
|
|
1309
|
+
}
|
|
1310
|
+
return penyimpanan
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1278
1313
|
module.exports = Util
|
package/lib/moduleLib.js
CHANGED
|
@@ -91,6 +91,11 @@ m.location = function (req, res, key) {
|
|
|
91
91
|
if(mapLocationJSON && mapLocationJSON.lat) {
|
|
92
92
|
$("#search_map_location").val(mapLocationJSON.address1);
|
|
93
93
|
initMap(mapLocationJSON.lat,mapLocationJSON.lon);
|
|
94
|
+
} else {
|
|
95
|
+
navigator.geolocation.getCurrentPosition(function(location) {
|
|
96
|
+
initMap(location.coords.latitude,location.coords.longitude);
|
|
97
|
+
$("#search_map_location").val("My Place");
|
|
98
|
+
});
|
|
94
99
|
}
|
|
95
100
|
searchAddressMap = document.querySelector("#search_map_location");
|
|
96
101
|
autocompleteMap = new google.maps.places.Autocomplete(searchAddressMap, {
|
|
@@ -100,6 +105,7 @@ m.location = function (req, res, key) {
|
|
|
100
105
|
searchAddressMap.focus();
|
|
101
106
|
autocompleteMap.addListener("place_changed", fillInAddress);
|
|
102
107
|
}
|
|
108
|
+
|
|
103
109
|
function fillInAddress() {
|
|
104
110
|
const place = autocompleteMap.getPlace();
|
|
105
111
|
let lat = place.geometry.location.lat();
|