Global

Members

(package, constant) debugging :boolean

mode
Type:
  • boolean
Source:

(constant) DiaryStandardRecordStatus :string

Valid record statuses
Type:
  • string
Properties:
Name Type Description
awake string user is currently awake
in_bed string user is in bed but not asleep
asleep string user is asleep
"lights off" string user is currently turning off the lights in preparation to go to bed
"lights on" string user is currently turning on the lights after getting out of bed
snack string user is eating some food, but not a full meal
meal string user is eating a full meal
alcohol string user is consuming alcohol
chocolate string user is consuming chocolate
caffeine string user is consuming caffeine
drink string user is consuming a drink that doesn't fit into any other category
"sleep aid" string user is taking a sleeping pill, tranqulisier, or other medication to aid sleep
exercise string user is exercising
toilet string user is using the toilet
noise string user is experiencing noise that disturbs their sleep
alarm string user's wake-up alarm is trying to wake them up
"in bed" string user is currently getting into bed
"out of bed" string user is currently getting out of bed
Source:

(constant) sleepdiary_engines :Array.<DiaryEngine>

List of known engines for sleep diaries
Type:
Source:
Tutorials:
  • Tutorial: List supported engines

system_timezone

Default timezone for this system This is constant in normal operation, but can be overridden by unit tests
Source:

Methods

new_sleep_diary(file, serialiseropt) → {Object|null}

Low-level reader interface
Parameters:
Name Type Attributes Description
file string | Object file contents, or filename/contents pairs (for archive files)
serialiser function <optional>
function to serialise output
Source:
Throws:
Will throw an error for unrecognised documents
Returns:
diary, or null if the document could not be parsed
Type
Object | null
Example
let diary = new_sleep_diary(contents_of_my_file));

Type Definitions

Array

Source:

DiaryEngine

Type:
  • Object
Source:

DiaryStandardRecord

A single record in a diary (e.g. one sleep) - see README.md for details
Type:
  • Object
Source:

DiaryStandardStatistics

Information about records from a diary
Type:
  • Object
Source:

MaybeDiaryStandardStatistics

Type:
Source:

SpreadsheetHighLevelCellRule

Define a high-level rule for serialising/parsing a spreadsheet cell.

key should be the name of a member of the relevant data structure, type should be number, time, duration or string (the default). If regexp is passed, the value is expected to match that pattern.

Type:
  • Object
Source:

SpreadsheetLowLevelCellRule

Define a low-level rule for serialising/parsing a series of cells.

keys should be a non-empty array of member names that will be created. import and export are functions that take three arguments (array_element, row and offset) and return a value that indicates whether the operation was a success. import is expected to copy values from row to array_element, wheraes export copies data back to row.

Type:
  • Object
Source:

SpreadsheetSheetRule

Define the conversion to/from a single sheet in the spreadsheet.

sheet should be the name of the sheet in the spreadsheet. member should be the name of the associated member in the data structure (if different from sheet).

Type:
  • Object
Source: