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

@l.degener/text-table

v0.2.1

Published

Yet another JavaScript library for producing plain-text tables

Downloads

9

Readme


Random Notes

.. note::

This file does not necessarily describe the current state, its just some random ideas that may or may not be implemented.

A table is a sequence of rows. A row is a sequence of cells. A column is, too.

We use the word delimiter for characters between adjacent columns, and separator for characters between adjacent rows. No particular reason, it's just how it turned out. A character may be a delimiter and a separator at the same time, in which case we call it a crossing.

The width of a column includes any padding or potential delimiters on either side of the column.

Specifying delimiters/separators using pattern matching

I had this idea before, but never actually tried it. Let's say, all cells have a label consisting of a single symbol, preferably something that can be represented as a single character. Then we could use rules like this:

.. code:

"HHH" "H| " " " " " "===" "=+ " "---" "-+ " "BBB" "B| " "HHH" "H| "

A pattern rule is made from a 3x3 grid of symbols. Of the nine symbols, four are input symbols:

.. code:

"HH" "H " " " " " "BB" "B " "HH" "H "

And the remaining five are output symbols

.. code:

" "    "|"      " "     " "

"===" "=+ " "---" "-+ " " " "|" " " "|"

To encode a table like the one in the example <example.coffee>_, we need three types of label: " ", "B" and "H". In theory there are 3^4=81 possible combination of input symbols. But here we only use a few of them.

Also, we do not need the 5 output cells for each pattern, because the patterns will usually overlap. It should be enough (again, in theory) to only examine the output symbol at the very center. This should also eliminate the problem of over specification.

So... a rule would be a (partial) function r: I -> I -> I -> I -> O Better still, I think we can "learn" this function from looking at a schematic example like the one below. (Not "learn" as in machine learning, but much, much more simple.)

.. code: " " " ┌─┬─┐ " " │H│H│ " " ┝━┿━┥ " " │B│B│ " " ├─┼─┤ " " │B│B│ " " └─┴─┘ " " "

Move a 9x9 "window" over the example, only sample the four corners (input) and the center (output). Voila. Of course this only works if the example is consistent. If it is not, this is easy to detect.

" H" -> "┌" " ││" -> "─"