npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

efgh

v0.4.0

Published

Echomail in Fidonet: generator of headers.

Downloads

42

Readme

(a histogram of downloads)

Echomail of Fidonet: generator of headers

This module (efgh) is a generator of HTML5 representations of headers for Fidonet echomail messages.

This module is written in JavaScript and requires Node.js to run. It uses some ECMAScript 2015 features, and thus a relatively recent Node.js is required. The module is tested against Node.js v4.x and the latest stable Node.js version.

Installing EFGH

(npm package version)

  • Latest packaged version: npm install efgh

  • Latest githubbed version: npm install https://github.com/Mithgol/efgh/tarball/master

The npm package does not contain the tests, they're published on GitHub only.

You may visit https://github.com/Mithgol/efgh#readme occasionally to read the latest README because the package's version is not planned to grow after changes when they happen in README only. (And npm publish --force is forbidden nowadays.)

Using EFGH

When you require() the installed module, an object is returned.

That object's sync property represents the synchronous interface. An asynchronous interface is planned, but not (yet) implemented.

The synchronous interface

When you require() the installed module, an object is returned. Its sync property represents the synchronous interface.

That property is a function that accepts an object of settings and returns (synchronously) the corresponding HTML5 representation of a header for a Fidonet echomail message.

That header is returned as a JavaScript string.

An object of settings has the following fields:

  • (TODO: not ready) nodelist — by default, false. It may also contain an object constructed by the constructor returned from the Fidonet nodelist module. In the latter case, the Fidonet nodelist is used to determine the physical location (town, suburb, city, etc.) of the message's sender (using the Fidonet address); that location is displayed in the header.

  • avatarWidth — width (in CSS pixels) of an avatar of the message's author (or of a default avatar). By default, 140. This value does not have to be equal to the avatar's width in physical pixels (for example, where window.devicePixelRatio != 1 in your client-side code).

  • avatarURL — URL of the avatar (i.e. of the picture).

  • from — the sender's name.

  • origAddr — the sender's address.

  • to — the recipient's name.

  • origTime — the time when the message was written. Either a string or an array of year, month, day, hour, minute, second.

  • procTime — the time when the message was processed by an echoprocessor. Either a string or an array of year, month, day, hour, minute, second.

    • This setting is optional. You may decide to pass an undefined value if you prefer the headers of the same Fidonet message to be exactly the same on different Fidonet systems (i.e. to not depend on the processing's time). For example, it helps to prevent redundant copies of the message in a global content-addressable storage (such as IPFS).
  • subj — the message's subject line.

  • URLFGHI URL of the message.

  • messageHTML — by default, false. It means that the HTML5 table is closed by its closing tag (</table>).

    • If messageHTML === true, the header (HTML5 <table>) is not completed and thus the returned string ends with open tr and td elements; the message's main text (in HTML) can be added after those elements and ended with </td></tr></table> to end the table. The td element is given the class messageText.
    • Also messageHTML can be a JavaScript string containing the message's main text (in HTML). In such case the string returned from .sync() contains the whole message (not only the header as an HTML table, but also the main text in the last row of the same HTML table).

CSS rules

Three Bootstrap classes ('table', 'table-bordered', 'table-condensed') are assigned to the header's table.

Two additional classes are used for EFGH purposes:

  • inverse — this class is assigned to individual headers (From, To, Subj, FGHI URL) and provides an inverted look (white text on dark background)

  • avatar — this class is assigned to the TH element of the avatar (user's picture) and ensures its proper display (for example, background-size: contain).

CSS rules for these two EFGH classes are provided in the file styles/efgh.css. Users of EFGH are expected to reference that file or include it in their CSS.

  • To facilitate such references, require('efgh').pathCSS() returns path.join(__dirname, 'styles', 'efgh.css') (in other words, the full path to the efgh.css file).

HTML5 headers generated by EFGH may not be displayed properly if HTML5 representation is provided without the corresponding CSS rules (for example, in description elements of RSS items).

Testing EFGH

(build testing status)

It is necessary to install Mocha and JSHint for testing.

  • You may install Mocha globally (npm install mocha -g) or locally (npm install mocha in the directory of EFGH).

  • You may install JSHint globally (npm install jshint -g) or locally (npm install jshint in the directory of EFGH).

After that you may run npm test (in the directory of EFGH).

License

MIT license (see the LICENSE file).