haraka-notes

Haraka Notes

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
haraka-notes
1.0.62 years ago6 years agoMinified + gzip package size for haraka-notes in KB

Readme

!Build Statusci-imgci-url !Code Climateclim-imgclim-url !Code Coveragecov-imgcov-url !NPMnpm-imgnpm-url
haraka-notes
Notes are objects that exist on Haraka connections and transactions. Prior to the release of haraka-notes, notes was just an empty object. Now notes is an empty object with two functions:

set (path, value)

Sets a note at a dot delimited path to the specified value. The path can be any number of levels deep and any missing objects in the path are autovivified. Perl refugees, contain yourselves.
connection.transaction.notes.set('queue.wants', 'smtp_forward');

The above command sets connection.transaction.notes.queue.wants to the value 'smtpforward'.

get (path)

Fetches the value of a note from a given dot delimited path.
connection.transaction.notes.get('queue.wants');

Array Syntax

The get and set functions support passing the path as an array of strings. This might be useful to the type of masochist that has dots in their JS/JSON keys. Example:
connection.transaction.notes.get(['i.do','like','pa.in']);

Note Path Registry

To reduce the likelihood of namespace collisions in Haraka notes, consider registering the note paths your plugins use in the registry
.