This repository has been archived by the owner on Apr 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v1.4.1: bring astro deps in line with api
- Loading branch information
J. T. L
committed
Sep 21, 2018
1 parent
730fbbf
commit 41df68d
Showing
12 changed files
with
240 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "@darkskyapp" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
node_modules/ | ||
coverage/ | ||
/.nyc_output | ||
/coverage | ||
/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
"use strict"; | ||
const Lunar = require("./lunar"); | ||
const Solar = require("./solar"); | ||
|
||
class Astro { | ||
constructor() { | ||
this.lunar_cache = null; | ||
this.solar_cache = null; | ||
} | ||
|
||
lunar(time_ms) { | ||
if(this.lunar_cache === null) { | ||
this.lunar_cache = new Map(); | ||
} | ||
|
||
let lunar = this.lunar_cache.get(time_ms); | ||
if(lunar === undefined) { | ||
lunar = new Lunar(time_ms); | ||
this.lunar_cache.set(time_ms, lunar); | ||
} | ||
|
||
return lunar; | ||
} | ||
|
||
solar(time_ms) { | ||
if(this.solar_cache === null) { | ||
this.solar_cache = new Map(); | ||
} | ||
|
||
let solar = this.solar_cache.get(time_ms); | ||
if(solar === undefined) { | ||
solar = new Solar(time_ms); | ||
this.solar_cache.set(time_ms, solar); | ||
} | ||
|
||
return solar; | ||
} | ||
} | ||
|
||
module.exports = Astro; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"use strict"; | ||
const J1970 = -10957.5; | ||
|
||
function to(ms) { | ||
return J1970 + ms / 86400000; | ||
} | ||
|
||
function from(t) { | ||
return (t - J1970) * 86400000; | ||
} | ||
|
||
exports.to = to; | ||
exports.from = from; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.