New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

mapsqlite

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mapsqlite

a SQL base map like storage for nodejs

latest
npmnpm
Version
1.2.3
Version published
Maintainers
1
Created
Source

Simple Key-Value Storage Function

This Node.js module exports a single function, load(table_name), that provides easy access to a key-value storage system backed by an SQLite database.

Function:

  • load(table_name):
    • Takes the name of a table (assumed to exist in the database and creates if not).
    • Returns an object with three methods:
      • set(key, value): Sets the value for the given key. If the key doesn't exist, it creates a new entry.
      • get(key): Retrieves the value associated with the given key and undefined if key doesn't exist.
      • find(value): Returns all keys for the given value in an array.

Usage:

npm install mapsqlite

const { load } = require("mapsqlite");
const myMap = load("1337");

console.log("hello:", myMap.get("hello"));
//hello: undefined

myMap.set("hello", "world");
console.log("hello:", myMap.get("hello"));
//hello: world

console.log(myMap.find("world"));
//["hello"]

FAQs

Package last updated on 18 Feb 2024

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