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

genepi

v2.1.0

Published

fast reading library

Downloads

8

Readme

genepi Build Status

A tiny fast reading library. It is not usable by itself but you can have a look at genepi-console to use it from your terminal.

Install

$ npm install genepi

Usage

const { genepi } = require('genepi')
const DELAY = 180

const outputter = {
  header: function header() { /* do stuff */ },
  inner: function inner(word, index) { /* do stuff */ },
  footer: function footer() { /* do stuff */ }
}

function genepize(text) {
  return genepi(text, myOutputter, DELAY)
}

genepize('This is a text')
  .then(() => console.log('end of treatment'))

API

GenepiReader class

GenepiReader class extends SimpleEmitter which is a minimalistic way to send event to a listener. It provides on and emit functions. GenepiReader provides functions to change reading parameters

  • constructor(text, outputter) take a text and an object (outputter) which handle words
  • read(delayMs = 200, position = 0, backward = false) executes function of the outputter (header(), inner(word, index) and footer())
  • pause() pause reading and returns current position
  • changeDelay(delay) which pause then play with given delay
  • get length() get number of words
  • get isBackward() return true if reader is reading backward
  • get delay() return current delay {
  • get position() return current position {
  • get status() return current status {
  • emitStatusChange(status) emit a 'StatusChange' event with status as a string for payload. This is the function internally used by other functions that changes reading status. Possible statuses are:
    • 'init'
    • 'reading'
    • 'paused'
    • 'end'

GenepiReaderEE class

GenepiReaderEE is the same as GenepiReader but extending node's EventEmitter.

customize function

customize is a function allowing user to chose extended class as function parameter. It returns a class of readers. So, given a MyEventEmitter a reader can be instanciated as follow

const myCustomReader = new customize(MyEventEmitter)

SimpleEmitter

The minimalistic event emitter used by GenepiReader is a class with two methods:

  • on(event, callback): to register a listener (callback)
  • emit(event, data): to send an event to listener with data as a payload

Only those two methods from EventEmitter are called by GenepiReader. As EventEmitter may not be available outside of NodeJS, SimpleEmitter is here to give a mean to call listeners in an internal use only. It is not exposed by the API.