+53
-2
@@ -171,2 +171,49 @@ const fs = require('fs'); | ||
| //Location | ||
| class Location { | ||
| constructor(latitude, longitude) { | ||
| this.latitude = latitude; | ||
| this.longitude = longitude; | ||
| } | ||
| getLatitude() { | ||
| return this.latitude; | ||
| } | ||
| getLongitude() { | ||
| return this.longitude; | ||
| } | ||
| setLatitude(latitude) { | ||
| this.latitude = latitude; | ||
| } | ||
| setLongitude(longitude) { | ||
| this.longitude = longitude; | ||
| } | ||
| calculateDistance(otherLocation) { | ||
| const R = 6371e3; | ||
| const φ1 = this.latitude * Math.PI / 180; | ||
| const φ2 = otherLocation.getLatitude() * Math.PI / 180; | ||
| const Δφ = (otherLocation.getLatitude() - this.latitude) * Math.PI / 180; | ||
| const Δλ = (otherLocation.getLongitude() - this.longitude) * Math.PI / 180; | ||
| const a = Math.sin(Δφ / 2) * Math.sin(Δφ / 2) + | ||
| Math.cos(φ1) * Math.cos(φ2) * | ||
| Math.sin(Δλ / 2) * Math.sin(Δλ / 2); | ||
| const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); | ||
| const distance = R * c; | ||
| return distance; | ||
| } | ||
| } | ||
| const currentLocation = new Location(37.7749, -122.4194); // San Francisco coordinates | ||
| const destination = new Location(34.0522, -118.2437); // Los Angeles coordinates | ||
| const distance = currentLocation.calculateDistance(destination); | ||
| console.log("Distance between San Francisco and Los Angeles:", distance.toFixed(2), "meters"); | ||
| //RGB2Hex | ||
@@ -204,3 +251,7 @@ function RGB2Hex(R, G, B){ | ||
| } | ||
| module.exports = Bake | ||
| if(typeof module !== "undefined"){ | ||
| module.exports = Bake | ||
| } | ||
| else { | ||
| exports.exports = Bake | ||
| } |
+7
-1
| { | ||
| "name": "jsbakery", | ||
| "version": "0.0.1", | ||
| "version": "0.0.2", | ||
| "description": "Bake up your javascript using the new bake module", | ||
@@ -16,3 +16,9 @@ "main": "index.js", | ||
| }, | ||
| "exports": { | ||
| ".": { | ||
| "import": "./index.js", | ||
| "require": "./index.js" | ||
| } | ||
| }, | ||
| "devDependencies": {} | ||
| } |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
10598
17.21%235
20.51%