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

@liquicode/lib-datatable

v0.0.12

Published

A NodeJS library to manipulate an in memory table (array of arrays).

Downloads

5

Readme

lib-datatable (v0.0.12)

A NodeJS library to manipulate an in memory table (array of arrays).

Use the library to create a Datatable object. With a Datatable you can maniuplate a two dimesional array of data. You can add and remove columns, get and set individual cell values, and convert to and from an array of Javascript objects.

Internally, all data is stored as an array of arrays. This is an array of rows, each of which is composed of an array of cell values. There is no restriction on the content of a Cell, it can be of any nativa data type (e.g. number, string) or even a complex object.

A Datatable also maintains an array of column headings (data.column_headings). Column headings are not required for the primary functions of a Datatable but are used when converting a Datatable to and from an array of Javascript or JSON objects. In such cases, a Datatable column corresponds to a field within the object.

Since the internal representation of a Datatable is an array of arrays with an optional array of column metadata, a significant amount of overhead is avoided as compared to an array of JSON objects. That is, we are storing any object field names only once as column metadata rather than repeating this information for each stored object. This makes a Datatable take up much less memory and makes it an ideal format for serialization and transmission of large data.


Getting Started

Install via NPM:

npm install @liquicode/lib-datatable

Simple Usage

Include the Datatable library in your source code

const LibDatatable = require( '@liquicode/lib-datatable' );

Create a Datatable object

let table = LibDatatable.NewDatable();		// Create an empty table with no rows or columns.
table.SetSize( 100, 5 );				// Resize the table to give it 100 rows and 5 columns.

Add some data

let counter = 0;
for( let row = 0; row < table.RowCount(); row++ )
{
	for( let col = 0; col < table.ColumnCount(); col++ )
	{
		table.SetValue( counter, row, col );
		counter++;
	}
}

Read some data

table.GetValue( 0, 0 ) === 0		// TRUE
table.GetValue( 'A1' ) === 0		// TRUE
table.GetValue( 0, 'A' ) === 0		// TRUE
table.GetValue( { row_num: 1, col_addr: 'A' } ) === 0		// TRUE

table.GetValue( 0, 1 ) === 1		// TRUE
table.GetValue( 'B1' ) === 1		// TRUE
table.GetValue( 0, 'B' ) === 1		// TRUE
table.GetValue( { row_num: 1, col_num: 2 } ) === 1		// TRUE

table.GetValue( 0, 2 ) === 2		// TRUE
table.GetValue( 'C1' ) === 2		// TRUE
table.GetValue( 0, 'C' ) === 2		// TRUE
table.GetValue( { row_index: 0, col_num: 3 } ) === 2		// TRUE

More Links