listore
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

listore

npm version npm downloads bundle JSDocs License

Store data without defining key names multiple times

interface Pet {
  species: string
  name: string
  age: number
}

const listore = new Listore<Pet>(['species', 'name', 'age'])
// listore instanceof Array

listore.push(['cat', 'Fluffy', 4])
listore.push(['dog', 'Spot', 7])
listore.push(['cat', 'Mittens', 2])

const objects = listore.toObjects()
/**
 * [
 *  { species: 'cat', name: 'Fluffy',  age: 4 },
 *  { species: 'dog', name: 'Spot',    age: 7 },
 *  { species: 'cat', name: 'Mittens', age: 2 },
 * ]
 */

const csv = listore.toCSV()
/**
 * species,name,age
 * cat,Fluffy,4
 * dog,Spot,7
 * cat,Mittens,2
 */

// or construct Listore from xxx
Listore.fromCSV(csv)
Listore.fromObjects(objects)

features

  • Easy to use, just like built-in Array
  • Self contained, ZERO dependency
  • Supports wide range of formats
    • CSV (in, out)
    • HTML table (out)
    • HTMLTableElement (in)

Readme

Keywords

none

Package Sidebar

Install

npm i listore

Weekly Downloads

9

Version

1.0.0

License

MIT

Unpacked Size

19.5 kB

Total Files

8

Last publish

Collaborators

  • yieldray