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

lune

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lune

Calculate the phases of the moon

  • 0.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
968
decreased by-32.07%
Maintainers
1
Weekly downloads
 
Created
Source

Lune Build Status

Lune.js — calculate the phases of the moon.

Installation

npm install lune

Usage

To calculate current phase information:

var lune = require('lune');
var current_phase = lune.phase();
console.log(current_phase);
Output:
{
  phase: 0.5358014231208499,
  illuminated: 0.9874029678753915,
  age: 15.822531440340462,
  distance: 399704.2447849964,
  angular_diameter: 0.4982638055473454,
  sun_distance: 147790721.2629182,
  sun_angular_diameter: 0.539600532418603
}

To calculate phase information for a specific date:

var lune = require('lune');
var some_date = new Date(2014, 1, 17);
var some_date_phase = lune.phase(some_date);
console.log(some_date_phase);
Output:
{
  phase: 0.5616632223402672,
  illuminated: 0.9629393807872504,
  age: 16.586245595613818,
  distance: 396868.3763643785,
  angular_diameter: 0.5018242066159135,
  sun_distance: 147816061.66410872,
  sun_angular_diameter: 0.5395080276270386
}

To search for recent phases around the current date:

var lune = require('lune');
var recent_phases = lune.phase_hunt();
console.log(recent_phases);
Output:
{
  new_date: Thu Jan 30 2014 21:40:35 GMT-0500 (EST),
  q1_date: Thu Feb 06 2014 19:22:34 GMT-0500 (EST),
  full_date: Fri Feb 14 2014 23:54:47 GMT-0500 (EST),
  q3_date: Sat Feb 22 2014 17:16:56 GMT-0500 (EST),
  nextnew_date: Sat Mar 01 2014 08:02:42 GMT-0500 (EST)
}

To search for recent phases around a specific date:

var lune = require('lune');
var some_date = new Date(2014, 1, 17);
var some_date_phase = lune.phase_hunt(some_date);
console.log(some_date_phase);
Output:
{
  new_date: Thu Jan 30 2014 21:40:35 GMT-0500 (EST),
  q1_date: Thu Feb 06 2014 19:22:34 GMT-0500 (EST),
  full_date: Fri Feb 14 2014 23:54:47 GMT-0500 (EST),
  q3_date: Sat Feb 22 2014 17:16:56 GMT-0500 (EST),
  nextnew_date: Sat Mar 01 2014 08:02:42 GMT-0500 (EST)
}

Image

Moon image graciously provided by Mike DiLuigi.

Contributing

Please feel free to contribute to this project! :) Pull requests and feature requests welcome!

License

See LICENSE file in this repo

Keywords

FAQs

Package last updated on 17 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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