Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pandazy/capybara

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pandazy/capybara

A handy database library

  • 0.1.12
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-92.31%
Maintainers
1
Weekly downloads
 
Created
Source

Capybara

Overview >>

This is a TypeScript library providing simple database mechanism supporting the features below:

  • functional-rogramming-style basic CRUD operations
  • searches optimized by simple database index

How to use it >>

Create a data table

import { Row } from '@pandazy/capybara';

interface MyRow extends Row {
  name: string;
}

const table: BasicTable<MyRow> = {
  rows: {},
  lastNewId: 0
};

or

import { Row, basicTable } from '@pandazy/capybara';

interface MyRow extends Row {
  name: string;
}

const table = basicTable<MyRow>();

Add new rows to a table

const table = basicTable<MyRow>(); // { rows: {}, lastNewId: 0 }

const rows: MyRow[] = [
  { name: 'foo' },
  { name: 'bar' }
]

const { newRowKeys, updatedTable } = addRowsBasic<MyRow>(table, rows);

/*
  newRowKeys:
    ['1', '2']
  updatedTable:
    { rows: {
          '1': { name: 'foo' },
          '2': { name: 'bar' }
        },
        lastNewId: 2
    }

Update rows

TBD

Remove rows

TBD

Add index to the table

Q:Why index?

A: Index helps improving searching performance by decreasing the complexity.

∆ Currently this library only supports simple hashmap index which guarantees a O(1) complexity

TBD

Keywords

FAQs

Package last updated on 27 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc