returnC - Oppenjaimer/LbelDB.js GitHub Wiki

returnC(inx, [object = false])

Return certain column or columns from local memory.

Parameter Type Optional Default Description
inx number or number[] or string or string[] none Index or indices or label or labels of the column or columns to return.
object boolean ✔️ false Whether to return the column or columns data as an object or not.

Returns: Array or Array[] or Object - Column or columns data.

Example:

/*
dbs.lbel:
id
user
age
employed

dat.lbel:
10001
Jaime
28
false
*/

const ldb = require("lbeldb");

ldb.retrieve(); // Labels: ["id", "user", "age", "employed"], Rows: [ ["10001", "Jaime", "28", "false"] ]

console.log(ldb.returnC([0, 1, 2])); // Output: [ ["id", "10001" ], [ "user", "Jaime" ], [ "age", "28"] ]
console.log(ldb.returnC([0, 1, 2])); // Output: { id: [ "10001" ], name: [ "Jaime" ], age: [ "28" ] }