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

tableman

v1.3.3

Published

A table data helper

Readme

tableman

Build Status Coverage Status

This package is used to deal with table structure data which retrieved from mysql or other databases.

table must has structure like:

var table = [
  {id: 1, num: 2},
  {id: 2, num: 10},
  {id: 3, num: 20},
];

methods

sum(table, options)

options (Object) =
  field (String): which field you wanna sum
  [where] (Function): filter rows which you need

example:

tableman.sum(table, {
  field: 'num',
  where: function (row) {return row.id > 1;}}
).should.eql(30);

count(table, options)

example:

tableman.count(table, {where: function (row) {return row.num > 5;}})

join(table1, table2, options)

options Object =
   on (Array|Function): ['field1', 'field2']
       or `function (a, b) {return a.sid === b.id}`

example:

// hign speed
tableman.join(table, otherTable, {on: ['id', 'sid']})
// very slow speed, but flexible
tableman.join(table, otherTable, {on: function (a, b) {
  return a.id === b.sid;
}})

leftJoin(table1, table2, options)

the same as join, but use left join strategy.

example:

tableman.leftJoin(table, otherTable, {on: function (a, b) {
  return a.id === b.sid;
}})

group(table, options)

options Object =
  by (String|Array): group by this field
  action (Function): function (rows: Array, column: String|Array) {}.
      `rows` would be the rows which be grouped

example:

tableman.group(otherTable, {
  by: 'address', // or ['adress', 'age']
  action: function (rows, column) {
    // column would be String or Array, decided by length of `by`
    return {count: rows.length};
  }})

select(table, columns)

example:

tableman.select(otherTable, ['sid', 'age'])

order(table, columns)

example:

// order by sid asc, age desc
tableman.order(otherTable, ['sid', '-age'])

benchmark

Node.js version is: v1.6.3
length of `groupTable` is: 256
length of `table` is: 500
length of `otherTable` is: 500
#group x 2,665 ops/sec ±4.10% (82 runs sampled)
table join otherTable with array x 4,676 ops/sec ±4.57% (72 runs sampled)
table join otherTable with function x 307 ops/sec ±3.52% (76 runs sampled)