<commit_before># seneca-suncalculator

## A plugin for [Seneca](http://senecajs.org) 
This plugin will expose actions to calculate the position of the sun or moon.

[![npm version](https://badge.fury.io/js/seneca-suncalculator.svg)](https://www.npmjs.com/package/seneca-suncalculator)
[![Build Status](https://travis-ci.org/mlinnen/seneca-suncalculator.svg)](https://travis-ci.org/mlinnen/seneca-suncalculator)

## Install
Since Seneca and this service are built on top of [Node.js](https://nodejs.org) you will need to have it installed.
To install run the following commands:
```
npm install seneca
npm install seneca-suncalculator
```

## Quick Example
Make sure you have already done the install steps to get the seneca and seneca-suncalculator modules in your working folder. 

```
var seneca = require('seneca')();

seneca.use('suncalculator');

// Uses today's date for the calcuation
seneca.act({role: 'suncalculator', cmd: 'calc', lat: 35.227085, long: -80.843124}, console.log);

// Uses a passed in date for the calcuation
seneca.act({role: 'suncalculator', cmd: 'calc', lat: 35.227085, long: -80.843124, date: new Date('Wed Mar 23 2017 22:40:23 GMT-0400 (Eastern Daylight Time)')}, console.log)
```
 
## Actions

### ACTION: role:suncalculator, cmd:calc
Calculates the sun and moon details for a specified date, lat, long.
- _lat_: the latitude for the calculation
- _long_: the longitude for the calculation
- _date_: the date for the calculation. If this is omitted then the current date is used.

Returns an answer object with times as a result of the calculation. 

### ACTION: role:suncalculator, cmd:calcdays
Calculates the sun and moon details for a specified date, lat, long and numberOfDays.
- _lat_: the latitude for the calculation
- _long_: the longitude for the calculation
- _date_: the date for the calculation. If this is omitted then the current date is used.
- _numberOfDays_: the number of days to calculate the times for starting with the _date_ as the first day.

Returns an answer object with times as a result of the calculation. 

### ACTION: role:suncalculator, cmd:eventcheck
Calculates the sun and moon details for a specified date, time, lat and long.  Uses this date & time to return a value that indicates if a specific event is currently occuring.
- _lat_: the latitude for the calculation
- _long_: the longitude for the calculation
- _date_: the date for the calculation. If this is omitted then the current date is used.

Returns an answer of the following: none, sunrise, sunset, dawn, dusk, night, sunriseEnd, sunsetStart, nightEnd, or solarNoon.

## Roadmap
These are a few items I think this module could use to make it more useful.  I don't have any plans on
when the following will be done or in what order.
- Allow for the _lat_ and _long_ be set as an options
- Add support for more suncalc actions
<commit_msg>Correct  documentation on calcdays<commit_after># seneca-suncalculator

## A plugin for [Seneca](http://senecajs.org) 
This plugin will expose actions to calculate the position of the sun or moon.

[![npm version](https://badge.fury.io/js/seneca-suncalculator.svg)](https://www.npmjs.com/package/seneca-suncalculator)
[![Build Status](https://travis-ci.org/mlinnen/seneca-suncalculator.svg)](https://travis-ci.org/mlinnen/seneca-suncalculator)

## Install
Since Seneca and this service are built on top of [Node.js](https://nodejs.org) you will need to have it installed.
To install run the following commands:
```
npm install seneca
npm install seneca-suncalculator
```

## Quick Example
Make sure you have already done the install steps to get the seneca and seneca-suncalculator modules in your working folder. 

```
var seneca = require('seneca')();

seneca.use('suncalculator');

// Uses today's date for the calcuation
seneca.act({role: 'suncalculator', cmd: 'calc', lat: 35.227085, long: -80.843124}, console.log);

// Uses a passed in date for the calcuation
seneca.act({role: 'suncalculator', cmd: 'calc', lat: 35.227085, long: -80.843124, date: new Date('Wed Mar 23 2017 22:40:23 GMT-0400 (Eastern Daylight Time)')}, console.log)
```
 
## Actions

### ACTION: role:suncalculator, cmd:calc
Calculates the sun and moon details for a specified date, lat, long.
- _lat_: the latitude for the calculation
- _long_: the longitude for the calculation
- _date_: the date for the calculation. If this is omitted then the current date is used.

Returns an answer object with times as a result of the calculation. 

### ACTION: role:suncalculator, cmd:calcdays
Calculates the sun and moon details for a specified date, lat, long and numberOfDays.
- _lat_: the latitude for the calculation
- _long_: the longitude for the calculation
- _date_: the date for the calculation. If this is omitted then the current date is used.
- _numberOfDays_: the number of days to calculate the times for starting with the _date_ as the first day.

Returns an answer object with an array of times as a result of the calculation. 

### ACTION: role:suncalculator, cmd:eventcheck
Calculates the sun and moon details for a specified date, time, lat and long.  Uses this date & time to return a value that indicates if a specific event is currently occuring.
- _lat_: the latitude for the calculation
- _long_: the longitude for the calculation
- _date_: the date for the calculation. If this is omitted then the current date is used.

Returns an answer of the following: none, sunrise, sunset, dawn, dusk, night, sunriseEnd, sunsetStart, nightEnd, or solarNoon.

## Roadmap
These are a few items I think this module could use to make it more useful.  I don't have any plans on
when the following will be done or in what order.
- Allow for the _lat_ and _long_ be set as an options
- Add support for more suncalc actions

{'fraction_non_alphanumeric': 0.08745445080687142, 'fraction_numerical': 0.01665799062988027, 'mean_word_length': 4.479087452471483, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 10, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1708373', 'n_tokens_mistral': 1821, 'n_tokens_neox': 1639, 'n_words': 774}