New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bun-sqlite-key-value

Package Overview
Dependencies
Maintainers
0
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bun-sqlite-key-value - npm Package Compare versions

Comparing version 1.3.3 to 1.3.4

tests/filesystem.test.ts

4

examples/getItemsArrayExample.ts

@@ -10,3 +10,3 @@ import { BunSqliteKeyValue } from "../src"

const items1 = store.getItemsArray("language:")
const items1 = store.getItems("language:")
console.log(items1)

@@ -19,3 +19,3 @@ // --> [

const items2 = store.getItemsArray(["language:de", "language:it"])
const items2 = store.getItems(["language:de", "language:it"])
console.log(items2)

@@ -22,0 +22,0 @@ // --> [

@@ -29,3 +29,3 @@ import { BunSqliteKeyValue } from "../src"

// Read all settings
const settingItems = settingsStore.getItemsArray()
const settingItems = settingsStore.getItems()
console.log(settingItems)

@@ -32,0 +32,0 @@ // -> [

{
"name": "bun-sqlite-key-value",
"description": "A super fast key-value store with SQLite that uses bun:sqlite and v8 as faster JSON replacement.",
"version": "1.3.3",
"version": "1.3.4",
"author": "Gerold Penz<gerold@gp-softwaretechnik.at>",

@@ -6,0 +6,0 @@ "module": "src/index.ts",

@@ -66,4 +66,4 @@ # Bun SQLite Key Value

```typescript
store.set(key, value, [ttlMs]) or
store.setValue(key, value, [ttlMs])
set(key: string, value: any, [ttlMs: number]): void
setValue(key: string, value: any, [ttlMs: number]) // alias for set()
```

@@ -105,4 +105,4 @@

```typescript
store.get(key) or
store.getValue(key)
get(key: string): any
getValue(key: string) // alias for get()
```

@@ -130,3 +130,3 @@

```typescript
store.getItem(key)
getItem(key: string): {key: string, value: any}
```

@@ -157,12 +157,14 @@

```typescript
store.getValues(startsWith)
getValues(startsWithOrKeys: string | string[]): any[]
```
- `startsWith`:
String with which the keys whose values are to be returned begin.
It is advisable to divide keys into ranges using separators.
For example `"language:de"`, `"language:en"`, `"language:it"`.
A search for `"language:"` would return all languages.
- `startsWithOrKeys`:
- **string**: String with which the keys whose values are to be returned begin.
It is advisable to divide keys into ranges using separators.
For example `"language:de"`, `"language:en"`, `"language:it"`.
A search for `"language:"` would return all languages.
- **string[]**: Array with keys. The returned array is exactly
the same size as the passed array.
Entries that are not found are returned as `undefined`.
#### Example

@@ -190,10 +192,13 @@

```typescript
store.getItemsArray(startsWith)
getItemsArray(startsWithOrKeys: string | string[]): {key: string, value: any}[]
```
- `startsWith`:
String with which the keys whose items are to be returned begin.
It is advisable to divide keys into ranges using separators.
For example `"language:de"`, `"language:en"`, `"language:it"`.
A search for `"language:"` would return all languages.
- `startsWithOrKeys`:
- **string**: String with which the keys whose items are to be returned begin.
It is advisable to divide keys into ranges using separators.
For example `"language:de"`, `"language:en"`, `"language:it"`.
A search for `"language:"` would return all languages.
- **string[]**: Array with keys. The returned array is exactly
the same size as the passed array.
Entries that are not found are returned as `undefined`.

@@ -257,3 +262,3 @@

// Read all settings
const settingItems = settingsStore.getItemsArray()
const settingItems = settingsStore.getItems()
console.log(settingItems)

@@ -260,0 +265,0 @@ // -> [

@@ -7,3 +7,3 @@ import { Database, type Statement } from "bun:sqlite"

key: string
value: T
value: T | undefined
}

@@ -14,3 +14,3 @@

key: string
value: Buffer,
value: Buffer | null,
expires: number | null

@@ -127,3 +127,3 @@ }

key,
value: deserialize(value) as T
value: value ? deserialize(value) as T : undefined
}

@@ -142,3 +142,3 @@ }

getItemsArray<T = any>(startsWithOrKeys?: string | string[]): Item<T>[] | undefined {
getItems<T = any>(startsWithOrKeys?: string | string[]): Item<T>[] | undefined {
let records: RawItem[]

@@ -170,3 +170,3 @@ if (startsWithOrKeys && typeof startsWithOrKeys === "string") {

key,
value: deserialize(value) as T
value: value ? deserialize(value) as T : undefined
})

@@ -181,9 +181,17 @@ }

getValues<T = any>(startsWithOrKeys?: string | string[]): T[] | undefined {
return this.getItemsArray<T>(startsWithOrKeys)?.map((result) => result.value)
// Alias for getItems
getItemsArray = this.getItems
getValues<T = any>(startsWithOrKeys?: string | string[]): (T | undefined)[] | undefined {
return this.getItems<T>(startsWithOrKeys)?.map((result) => result.value)
}
// Alias for getValues
getValuesArray = this.getValues
getItemsObject<T = any>(startsWithOrKeys?: string | string[]): {[key: string]: T} | undefined {
const items = this.getItemsArray(startsWithOrKeys)
const items = this.getItems(startsWithOrKeys)
if (!items) return

@@ -190,0 +198,0 @@ const result: {[key: string]: T} = {}

Sorry, the diff of this file is not supported yet

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