Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@math.gl/sun

Package Overview
Dependencies
Maintainers
3
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@math.gl/sun - npm Package Compare versions

Comparing version 3.5.6 to 3.6.0-alpha.1

dist/index.d.ts

4

dist/es5/index.js

@@ -8,3 +8,3 @@ "use strict";

enumerable: true,
get: function get() {
get: function () {
return _suncalc.getSunPosition;

@@ -15,3 +15,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _suncalc.getSunDirection;

@@ -18,0 +18,0 @@ }

@@ -8,18 +8,18 @@ "use strict";

exports.getSunDirection = getSunDirection;
var DEGREES_TO_RADIANS = Math.PI / 180;
var DAY_IN_MS = 1000 * 60 * 60 * 24;
var JD1970 = 2440588;
var JD2000 = 2451545;
var e = DEGREES_TO_RADIANS * 23.4397;
var M0 = 357.5291;
var M1 = 0.98560028;
var THETA0 = 280.147;
var THETA1 = 360.9856235;
const DEGREES_TO_RADIANS = Math.PI / 180;
const DAY_IN_MS = 1000 * 60 * 60 * 24;
const JD1970 = 2440588;
const JD2000 = 2451545;
const e = DEGREES_TO_RADIANS * 23.4397;
const M0 = 357.5291;
const M1 = 0.98560028;
const THETA0 = 280.147;
const THETA1 = 360.9856235;
function getSunPosition(timestamp, latitude, longitude) {
var longitudeWestInRadians = DEGREES_TO_RADIANS * -longitude;
var phi = DEGREES_TO_RADIANS * latitude;
var d = toDays(timestamp);
var c = getSunCoords(d);
var H = getSiderealTime(d, longitudeWestInRadians) - c.rightAscension;
const longitudeWestInRadians = DEGREES_TO_RADIANS * -longitude;
const phi = DEGREES_TO_RADIANS * latitude;
const d = toDays(timestamp);
const c = getSunCoords(d);
const H = getSiderealTime(d, longitudeWestInRadians) - c.rightAscension;
return {

@@ -32,7 +32,7 @@ azimuth: getAzimuth(H, phi, c.declination),

function getSunDirection(timestamp, latitude, longitude) {
var _getSunPosition = getSunPosition(timestamp, latitude, longitude),
azimuth = _getSunPosition.azimuth,
altitude = _getSunPosition.altitude;
var azimuthN = azimuth + Math.PI;
const {
azimuth,
altitude
} = getSunPosition(timestamp, latitude, longitude);
const azimuthN = azimuth + Math.PI;
return [-Math.sin(azimuthN), Math.cos(azimuthN), -Math.sin(altitude)];

@@ -50,3 +50,3 @@ }

function getRightAscension(eclipticLongitude, b) {
var lambda = eclipticLongitude;
const lambda = eclipticLongitude;
return Math.atan2(Math.sin(lambda) * Math.cos(e) - Math.tan(b) * Math.sin(e), Math.cos(lambda));

@@ -56,3 +56,3 @@ }

function getDeclination(eclipticLongitude, b) {
var lambda = eclipticLongitude;
const lambda = eclipticLongitude;
return Math.asin(Math.sin(b) * Math.cos(e) + Math.cos(b) * Math.sin(e) * Math.sin(lambda));

@@ -62,5 +62,5 @@ }

function getAzimuth(hourAngle, latitudeInRadians, declination) {
var H = hourAngle;
var phi = latitudeInRadians;
var delta = declination;
const H = hourAngle;
const phi = latitudeInRadians;
const delta = declination;
return Math.atan2(Math.sin(H), Math.cos(H) * Math.sin(phi) - Math.tan(delta) * Math.cos(phi));

@@ -70,5 +70,5 @@ }

function getAltitude(hourAngle, latitudeInRadians, declination) {
var H = hourAngle;
var phi = latitudeInRadians;
var delta = declination;
const H = hourAngle;
const phi = latitudeInRadians;
const delta = declination;
return Math.asin(Math.sin(phi) * Math.sin(delta) + Math.cos(phi) * Math.cos(delta) * Math.cos(H));

@@ -86,5 +86,5 @@ }

function getEclipticLongitude(meanAnomaly) {
var M = meanAnomaly;
var C = DEGREES_TO_RADIANS * (1.9148 * Math.sin(M) + 0.02 * Math.sin(2 * M) + 0.0003 * Math.sin(3 * M));
var P = DEGREES_TO_RADIANS * 102.9372;
const M = meanAnomaly;
const C = DEGREES_TO_RADIANS * (1.9148 * Math.sin(M) + 0.02 * Math.sin(2 * M) + 0.0003 * Math.sin(3 * M));
const P = DEGREES_TO_RADIANS * 102.9372;
return M + C + P + Math.PI;

@@ -94,4 +94,4 @@ }

function getSunCoords(dates) {
var M = getSolarMeanAnomaly(dates);
var L = getEclipticLongitude(M);
const M = getSolarMeanAnomaly(dates);
const L = getEclipticLongitude(M);
return {

@@ -98,0 +98,0 @@ declination: getDeclination(L, 0),

@@ -8,3 +8,3 @@ {

},
"version": "3.5.6",
"version": "3.6.0-alpha.1",
"keywords": [

@@ -22,3 +22,3 @@ "javascript",

},
"types": "src/index.d.ts",
"types": "dist/index.d.ts",
"main": "dist/es5/index.js",

@@ -33,3 +33,3 @@ "module": "dist/esm/index.js",

},
"gitHead": "0e69c70ff2e6373fed84d303cbf8198a6972944f"
"gitHead": "45386981340895bf201c2ebb76257c9bbffd8ff6"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc