Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

@kessler/tableify

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kessler/tableify

Create HTML tables from Javascript Objects


Version published
Weekly downloads
30K
increased by0.41%
Maintainers
1
Weekly downloads
 
Created
Source

@kessler/tableify

A fork of tableify. All the cli rekated code and dependencies is removed. Add public methods for generating a complete html document with styling:

var tableify = require('tableify')
// just the table
tableify({ foo: 'bar' })

// html document with style
tableify.htmlDoc({ foo: 'bar' })
tableify.fancyHtmlDoc({ foo: 'bar' })

From any JavaScript object, HTML tables create.

description

Given any Javascript object including Object, Array, Number, Date, null, undefined, primitives, etc, tableify generates HTML tables that represent each object. In the case of Arrays containing Objects (hash tables), it will generate a table with a header row containing the key names of the object found in the first element of the array.

Every value to be output to the table is processed through tableify recursively so objects containing other objects will result in tables within tables.

For each td cell that is created, a class is generated based on the constructor.name of the value, or null if the value is null.

install

npm install @kessler/tableify

usage

var tableify = require('tableify');

// embed the table in an html document with some styling
var html = tableify.htmlDoc({
	someArrayOfObjects : [
		{ a : 1, b : 2, c : 3  }
		, { a : 2, b : 3, c : 4 }
		, { a : 3, b : 4, c : 5 }
	]
	, someObject : {
		key1 : 'value1'
		, someArray : [
			'value2'
			, 'value3'
			, 'value4'
			, 'value5'
		]
		, someArrayOfObjects : [
			{ key2 : 123 }
			, { key2 : 234 }
			, { key2 : 345 }
		]
	}
});

console.log(html);

license

MIT

Keywords

FAQs

Package last updated on 09 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc