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

0.1.14 • Public • Published

indexdb-helper

install with npm:

npm i indexdb-helper
const db = new IndexDBHelper('NamaDB');
await db.versions(1).stores([
    {
      name: 'users', // table name
    }
]);

await db.users.add({
    id: 'users_1',
    name: 'users 1',
    address: 'address'
})

const results1 = await db.users.findCursor(d => d.name == 'users 1');
// we got results
// [
//     {
//         id: 'users_1',
//         name: 'users 1',
//         address: 'address'
//     }
// ]

const results2 = await db.users.findCursor(d => {
    if(d.name == 'users_1'){
        d.FieldToAdd = d.name+' '+d.address;
        return d;
    }
    return false;
});
// we got results
// [
//     {
//         id: 'users_1',
//         name: 'users 1',
//         address: 'address',
//         FieldToAdd: 'users 1 address'
//     }
// ]

Dependents (0)

Package Sidebar

Install

npm i indexdb-helper

Weekly Downloads

4

Version

0.1.14

License

none

Unpacked Size

33 kB

Total Files

10

Last publish

Collaborators

  • skrip