site/node_modules/lunarphase-js/dist/esm/lunarphase-js.js.map

1 line
15 KiB
Plaintext
Raw Normal View History

2022-10-22 09:24:08 -05:00
{"version":3,"file":"lunarphase-js.js","sources":["../../src/enum/Hemisphere.js","../../src/enum/LunarEmoji.js","../../src/enum/LunarMonth.js","../../src/enum/LunarPhase.js","../../src/enum/Unit.js","../../src/constants/Time.js","../../src/utils/MathUtil.js","../../src/JulianDay.js","../../src/Moon.js"],"sourcesContent":["/**\n * Earth's hemispheres.\n *\n * @typedef {string} Hemisphere\n * @enum {Hemisphere}\n */\nexport const Hemisphere = {\n NORTHERN: \"Northern\",\n SOUTHERN: \"Southern\",\n};\n","/**\n * Enumeration of lunar phases as emoji\n *\n * @typedef {string} LunarEmoji\n */\nexport const LunarEmoji = {\n /**\n * Enumeration of lunar phases as emoji for the Northern Hemisphere.\n * @num {LunarPhase}\n */\n NorthernHemisphere: {\n NEW: \"🌑\",\n WAXING_CRESCENT: \"🌒\",\n FIRST_QUARTER: \"🌓\",\n WAXING_GIBBOUS: \"🌔\",\n FULL: \"🌕\",\n WANING_GIBBOUS: \"🌖\",\n LAST_QUARTER: \"🌗\",\n WANING_CRESCENT: \"🌘\",\n },\n\n /**\n * Enumeration of lunar phases as emoji for the Southern Hemisphere.\n * @num {LunarPhase}\n */\n SouthernHemisphere: {\n NEW: \"🌑\",\n WAXING_CRESCENT: \"🌘\",\n FIRST_QUARTER: \"🌗\",\n WAXING_GIBBOUS: \"🌖\",\n FULL: \"🌕\",\n WANING_GIBBOUS: \"🌔\",\n LAST_QUARTER: \"🌓\",\n WANING_CRESCENT: \"🌒\",\n },\n};\n","/**\n * Lunar month, time between two successive syzygies of the\n * same type: new moons or full moons\n *\n * @typedef {string} LunarMonth\n * @enum {LunarMonth}\n */\nexport const LunarMonth = {\n ANOMALISTIC: \"Anomalistic\",\n DRACONIC: \"Draconic\",\n SIDEREAL: \"Sidereal\",\n SYNODIC: \"Synodic\",\n TROPICAL: \"Tropical\",\n};\n","/**\n * Enumeration of lunar phases\n *\n * @typedef {string} LunarPhase\n * @enum {LunarPhase}\n */\nexport const LunarPhase = {\n NEW: \"New\",\n WAXING_CRESCENT: \"Waxing Crescent\",\n FIRST_QUARTER: \"First Quarter\",\n WAXING_GIBBOUS: \"Waxing Gibbous\",\n FULL: \"Full\",\n WANING_GIBBOUS: \"Waning Gibbous\",\n LAST_QUARTER: \"Last Quarter\",\n WANING_CRESCENT: \"Waning Crescent\",\n};\n","/**\n * Units of measure\n *\n * @typedef {string} Unit\n * @enum {Unit}\n */\nexport const Unit = {\n EARTH_RADII: \"Earth Radii\",\n KILOMETERS: \"km\",\n MILES: \"m\",\n};\n","/**\n * Timestamp epoch, January 1, 1970, in Julian Days.\n * @type {number}\n */\nexport const EPOCH = 2440587.5;\n\n/**\n * Lunation 1 as the first new moon of 1923 at approximately\n * 02:41 UTC, January 17, 1923 per Ernest William Brown's lunar theory.\n * @type {number}\n */\nexport const LUNATION_BASE_JULIAN_DAY = 2423436.6115277777;\n\n/**\n * Length of one phase (1/8 of a synodic month) in Earth days.\n * @type {number}\n */\nexport const PHASE_LENGTH = 3.69132346322;\n\n/**\n * Orbital period of the Moon from perigee to apogee and back to perigee\n * @type {number}\n */\nexport const ANOMALISTIC_MONTH = 27.55454988;\n\n/**\n * Length of one synodic month - lunation, or days for the phases to complete a cycle.\n * Time between two identical syzygies, equivalent of 29.53059 Earth days.\n *\n * Based on Mean Synodic Month, 2000 AD mean solar days.\n * @type {number}\n */\nexport const SYNODIC_MONTH = 29.53058770576;\n","/**\n * Normalization utility for percentage calculations.\n *\n * @param {number} value Percent value.\n * @returns {number} Normalized value\n */\nexport const normalize = (value) => {\n value -= Math.floor(value);\n if (value < 0) {\n value += 1;\n }\n\n return value;\n};\n","import { EPOCH } from \"./constants/Time\";\n\n/**\n * Julian day from Gregorian date.\n * @param {Date} date Gregorian date to convert to Julian day.\n * @returns {number} Julian Day\n */\nexport const fromDate = (date = new Date()) => {\n const time = date.getTime();\n return time / 86400000 - date.getTimezoneOffset() / 1440 + EPOCH;\n};\n\n/**\n * Gregorian date from Julian day\n * @param {number} julian Julian dat to convert to Gregorian date\n * @returns {Date} Gregorian date\n */\nexport const toDate = (julian) => {\n let date = new Date();\n date.se