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 🙏

© 2026 – Pkg Stats / Ryan Hefner

smart-reading

v1.0.3

Published

Smart Reading is a tool that helps you read faster and easier using cognitive chunking.

Downloads

24

Readme

Smart Reading

npm version npm downloads

Smart Reading is a tool that helps you read faster and easier by using a technique called 'chunking'. It highlights the first portion of words to guide your eyes and improve reading speed and comprehension.

Note: This library is inspired by the Bionic Reading brand and technique. Bionic Reading is a trademarked reading method that uses strategic highlighting to guide eye fixation points. Smart Reading implements a similar approach as an open-source alternative.

Features

  • 🚀 Fast Text Processing: Efficiently processes text using the Intl.Segmenter API
  • 🎯 Customizable Fixation: Adjust the percentage of each word to highlight
  • 🏷️ Flexible Tagging: Use any HTML tag for highlighting (default: strong)
  • 📦 TypeScript Support: Fully typed with TypeScript
  • Well Tested: Comprehensive test coverage with Vitest
  • 🔧 Modular Architecture: Clean, modular codebase with separate concerns

Installation

npm install smart-reading

Usage

Basic Usage

import { smartReading } from "smart-reading";

const text = "Hello, world!";
const result = smartReading(text, {
  fixationPercentage: 0.3,
  tag: "strong",
});

console.log(result);
// Output: "<strong>He</strong>llo, <strong>wo</strong>rld!"

With Default Options

import { smartReading, defaultOptions } from "smart-reading";

const text = "This is a sample text";
const result = smartReading(text, defaultOptions);

Custom Options

import { smartReading } from "smart-reading";

const text = "Custom highlighting example";
const result = smartReading(text, {
  fixationPercentage: 0.4, // Highlight 40% of each word
  tag: "em", // Use <em> tag instead of <strong>
});

API Reference

smartReading(text: string, options: smartOptions): string

The main function that converts text to smart reading format (inspired by smart Reading technique).

Parameters:

  • text (string): The text to convert
  • options (smartOptions): Configuration options

Returns: string - The text with smart reading formatting applied

smartOptions

interface smartOptions {
  fixationPercentage: number; // Percentage of word to highlight (0-1)
  tag?: string; // HTML tag to use (default: "strong")
}

defaultOptions

const defaultOptions = {
  fixationPercentage: 0.3,
  tag: "strong",
};

Exported Functions

  • smartReading(text: string, options: smartOptions): string - Main conversion function
  • segmentText(text: string): Segmenter[] - Segment text into words and punctuation
  • wrapFixation(segment: string, options?: smartOptions): string - Wrap a segment with fixation tags
  • defaultOptions: Options - Default configuration options

Exported Types

  • smartOptions - Options interface for smart reading (inspired by smart Reading)
  • Options - Type for default options
  • Segmenter - Segment interface from text segmentation
  • WrapFixationProps - Props for wrap fixation function

How It Works

Smart Reading uses a technique inspired by smart Reading to improve reading speed and comprehension:

  1. Text Segmentation: The text is segmented into words and punctuation using the Intl.Segmenter API
  2. Word Detection: Only word-like segments are processed (punctuation and spaces are left unchanged)
  3. Fixation Calculation: For each word, a fixation point is calculated based on the fixationPercentage - this mimics the smart Reading approach of highlighting the first portion of words
  4. Tag Wrapping: The fixation portion of each word is wrapped with the specified HTML tag to create visual emphasis

Development

Prerequisites

  • Node.js
  • npm

Setup

npm install

Build

npm run build

Testing

Run the test suite:

npm test

The project uses Vitest for testing with coverage enabled.

Development Mode

npm run dev

Project Structure

src/
├── index.ts              # Main entry point (exports all modules)
├── convert.ts            # Main smart reading conversion function
├── segmenter.ts          # Text segmentation using Intl.Segmenter
├── options.ts            # Default options and types
├── types/
│   └── index.ts          # TypeScript type definitions
├── utils/
│   └── wrapFixation.ts   # Utility to wrap text with HTML tags
└── tests/
    ├── smartReading.test.ts
    ├── segmenter.test.ts
    └── utils/
        └── wrapFixation.test.ts

Architecture

The project now uses a clean, modular architecture:

  • Text Segmentation: Uses native Intl.Segmenter API for accurate word segmentation
  • Separation of Concerns: Each module has a single responsibility
  • Type Safety: Full TypeScript support with strict type checking
  • ES Modules: Modern ES module syntax throughout

License

ISC

Author

Angel Serrano

Repository

GitHub Repository

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

If you encounter any issues, please file them on the GitHub Issues page.