clearR - Oppenjaimer/LbelDB.js GitHub Wiki

clearR(inx)

Delete the row or rows at the specified index or indices from local memory.

Parameter Type Optional Default Description
inx number or number[] none Index or indices of the row or rows to delete.

Returns: void

Example:

const ldb = require("lbeldb");

ldb.init();
ldb.create(["user", "age", "employed"]); // Labels: ["id", "user", "age", "employed"]

ldb.addR(["Jaime", 28, false]); // Rows: [ [10001, "Jaime", 28, false] ]
ldb.addR(["Matt", 13, false]); // Rows: [ [10001, "Jaime", 28, false], [10002, "Matt", 13, false] ]
ldb.addR(["Natasha", 45, true]); // Rows: [ [10001, "Jaime", 28, false], [10002, "Matt", 13, false], [10003, "Natasha", 45, true] ]

ldb.clearR(1); // Rows: [ [10001, "Jaime", 28, false], [10002, "Natasha", 45, true] ]