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 🙏

© 2025 – Pkg Stats / Ryan Hefner

sequence-comparison-table

v0.2.1

Published

tools to help making sense of sequences

Readme

Sequence Comparison Table

Tools to help making sense of sequences. I use this for visualizing the sequence of events across browsers, amongst other things.

see demo

Installation

This package currently only works with AMD (e.g. RequireJS).

# via bower
bower install sequence-comparison-table
# via npm
npm install sequence-comparison-table

Usage

// input sequence data
var sourceData = {
  first: ['alpha', 'charlie', 'delta'],
  second: ['bravo', 'charlie', 'delta', 'echo'],
  third: ['alpha', 'alpha', 'charlie', 'alpha', 'delta'],
};

// work through the sequences
var mapSequences = require('./map-sequences');
var mapped = mapSequences(sourceData);

// resulting data structure
mapped === {
  // merged sequence (maintaining order, allowing duplicates)
  sequence: ['alpha', 'bravo', 'alpha', 'charlie', 'alpha', 'delta', 'echo'],
  // mapping input data indexes:
  // indexInSourceData === table.indexes[indexInTableRows]
  indexes: {
    first: [0, null, null, 1, null, 2, null],
    second: [null, null, 0, 1, null, 2, 3],
    third: [0, 1, null, 2, 3, 4, null],
  }
};

// translate sequences to a <tbody>
var sequenceTableBody = require('./sequence-table-body');
var tbody = sequenceTableBody(sourceData, {
  // manually define order of columns (defaults to Object.keys(sourceData))
  columns: ['first', 'second', 'third'],
  // callback to mutate generated table-cell
  cell: function(td, options) {
    // options
    //  .sequence        === mapped.sequence
    //  .indexes         === mapped.indexes
    //  .sequenceIndex   current index of mapped.sequence
    //  .sequenceItem    === mapped.sequence[ options.sequenceIndex ]
    //  .data            === sourceData
    //  .dataIndex       current index of sourceData[ options.dataKey ]
    //  .dataKey         current index of sourceData

    // the sequenceItem maps to the sourceData in the following way:
    // options.sequenceItem === (options.data[ options.dataKey ][ options.dataIndex ] || null)
  },
  // callback to mutate generated table-row
  row: function(tr, options) {
    // options
    //  .sequence        === mapped.sequence
    //  .indexes         === mapped.indexes
    //  .sequenceIndex   current index of mapped.sequence
    //  .sequenceItem    === mapped.sequence[ options.sequenceIndex ]
    //  .data            === sourceData
    //  .columns         === [
    //    options.indexes.first[ options.sequenceIndex ],
    //    options.indexes.second[ options.sequenceIndex ],
    //    options.indexes.third[ options.sequenceIndex ]
    //  ]
  },
  // callback to mutate generated table-row-th
  titleCell: function(th, options) {
    // options
    //  .sequence        === mapped.sequence
    //  .indexes         === mapped.indexes
    //  .sequenceIndex   current index of mapped.sequence
    //  .sequenceItem    === mapped.sequence[ options.sequenceIndex ]
    //  .data            === sourceData
  },
});

// translate sequences to a <table>
var sequenceTable = require('./sequence-table');
var table = sequenceTable(sourceData, {
  // same options as sequenceTableBody(), and:

  // map column names
  columnNames: {
    first: 'some',
    second: 'more',
    third: 'data',
  }
  // or callback function
  columnNames: function(th, key) {
    th.textContent = key;
  },

  // group columns:
  columnGroups: {
    'group 1': ['first'],
    'group 2': ['second', 'third'],
  },
});

Changelog

0.2.1 (December 4th 2014)

  • fixing package.json to properly include merge-arrays.js

0.2.0 (December 4th 2014)

  • adding columnNames callback signature to sequenceTable()
  • adding columGroups mapping to sequenceTable()
  • adding data-group="…" mapping on data cells to sequenceTable()
  • adding titleCell mapping to sequenceTableBody()
  • fixing sequenceTable() to treat options as an optional thing

0.1.0 (November 26th 2014)

  • initial release

License

sequence-comparison-table.js is published under the MIT License.