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

we-table

v0.0.3

Published

A table builder which is able to graft row from row

Downloads

9

Readme

weTable

A table builder which is able to graft row from row

Usage

Install

yarn add we-table or npm install we-table

Usage

import {
    Table,
    Row,
    Cell
} from 'we-table'

const table = new Table()

const priceName = new Row().addCell([new Cell("票价名称", 2, 3), new Cell("三楼200元"), new Cell("内场280元")])
const price = new Row().addCell([new Cell("1440元"), new Cell("720元")])
const priceAmount = new Row().addCell([new Cell("票价", 1, 3), new Cell(144000), new Cell(72000)])
const priceNumber = new Row().addCell([new Cell("可售张数", 1, 3), new Cell(9), new Cell(9)])
const priceRate = new Row().addCell([new Cell("已售比例", 1, 3), new Cell(0.5), new Cell(0.5)])

const firstRow = new Row()
            .addCell(new Cell("销售渠道", 5, 3))
            .appendRow(priceName)
            .addCell(new Cell("总计", 5))
// or:
// const firstRow = priceName.unshiftCell(new Cell("销售渠道", 5, 3)).addCell(new Cell("总计", 5))

table.addRow([firstRow, price, priceAmount, priceNumber, priceRate])

console.log(table.render())

Output

<table><tr><td rowspan="5" colspan="3" class="row-5 col-3">销售渠道</td><td rowspan="2" colspan="3" class="row-2 col-3">票价名称</td><td >三楼200元</td><td >内场280元</td><td rowspan="5" class="row-5">总计</td></tr><tr><td >1440元</td><td >720元</td></tr><tr><td colspan="3" class="col-3">票价</td><td >144000</td><td >72000</td></tr><tr><td colspan="3" class="col-3">可售张数</td><td >9</td><td >9</td></tr><tr><td colspan="3" class="col-3">已售比例</td><td >0.5</td><td >0.5</td></tr></table>

API reference

Modules

Classes

weTable

weTable: A table builder which is able to graft row from row

Cell

Cell: Table Cell (td)

Kind: global class

new Cell(content, row, col)

create a Cell instance

| Param | Type | Default | Description | | --- | --- | --- | --- | | content | String | | content to display | | row | Number | 1 | rowspan value | | col | Number | 1 | colspan value |

cell.setSpan(row, col)

set rowspan and colspan

Kind: instance method of Cell

| Param | Type | Default | Description | | --- | --- | --- | --- | | row | Number | 1 | rowspan value | | col | Number | 1 | colspan value |

cell.setClass(className)

set class name

Kind: instance method of Cell

| Param | Type | Description | | --- | --- | --- | | className | String | class name |

cell.render() ⇒ String

render td element str

Kind: instance method of Cell

Row

Row: Table Row (tr)

Kind: global class

new Row(cells)

create a Row instance

| Param | Type | Description | | --- | --- | --- | | cells | Array | Object | cell instance |

row.addCell(cells)

append cell(s) in the back of cells stack (push)

Kind: instance method of Row

| Param | Type | Description | | --- | --- | --- | | cells | Array | Object | cell instance |

row.unshiftCell(cells)

insert cell(s) in the front of cells stack (unshift)

Kind: instance method of Row

| Param | Type | Description | | --- | --- | --- | | cells | Array | Object | cell instance |

row.appendRow(row)

graft row cells in the back of cells stack

Kind: instance method of Row

| Param | Type | Description | | --- | --- | --- | | row | Row | row instance |

row.setClass(className)

set class name

Kind: instance method of Row

| Param | Type | Description | | --- | --- | --- | | className | String | class name |

row.render() ⇒ String

render tr element str

Kind: instance method of Row

Table

Table: HTML Table (table)

Kind: global class

new Table(rows)

create a Table instance

| Param | Type | Description | | --- | --- | --- | | rows | Array | Object | row instance |

table.addRow(rows)

append row(s) in the back of rows stack (push)

Kind: instance method of Table

| Param | Type | Description | | --- | --- | --- | | rows | Array | Object | row instance |

table.unshiftRow(rows)

insert row(s) in the front of rows stack (unshift)

Kind: instance method of Table

| Param | Type | Description | | --- | --- | --- | | rows | Array | Object | row instance |

table.setClass(className)

set class name

Kind: instance method of Table

| Param | Type | Description | | --- | --- | --- | | className | String | class name |

table.render() ⇒ String

render table element str

Kind: instance method of Table

docs autogenerated via jsdoc2md