Socket
Socket
Sign inDemoInstall

lowdb

Package Overview
Dependencies
1
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.5 to 5.1.0

lib/adapters/SessionStorage.d.ts

7

lib/adapters/LocalStorage.d.ts

@@ -1,7 +0,4 @@

import { SyncAdapter } from '../LowSync.js';
export declare class LocalStorage<T> implements SyncAdapter<T> {
#private;
import { WebStorage } from './WebStorage.js';
export declare class LocalStorage<T> extends WebStorage<T> {
constructor(key: string);
read(): T | null;
write(obj: T): void;
}

@@ -1,29 +0,6 @@

var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _LocalStorage_key;
export class LocalStorage {
import { WebStorage } from './WebStorage.js';
export class LocalStorage extends WebStorage {
constructor(key) {
_LocalStorage_key.set(this, void 0);
__classPrivateFieldSet(this, _LocalStorage_key, key, "f");
super(key, localStorage);
}
read() {
const value = localStorage.getItem(__classPrivateFieldGet(this, _LocalStorage_key, "f"));
if (value === null) {
return null;
}
return JSON.parse(value);
}
write(obj) {
localStorage.setItem(__classPrivateFieldGet(this, _LocalStorage_key, "f"), JSON.stringify(obj));
}
}
_LocalStorage_key = new WeakMap();
export * from './adapters/LocalStorage.js';
export * from './adapters/SessionStorage.js';
export * from './adapters/LocalStorage.js';
export * from './adapters/SessionStorage.js';
{
"name": "lowdb",
"version": "5.0.5",
"version": "5.1.0",
"description": "Tiny local JSON database for Node, Electron and the browser",

@@ -15,2 +15,3 @@ "keywords": [

"localStorage",
"sessionStorage",
"browser",

@@ -42,3 +43,3 @@ "esm"

"scripts": {
"test": "npm run build && xv lib",
"test": "xv --loader=ts-node/esm src",
"lint": "eslint src --ext .ts --ignore-path .gitignore",

@@ -54,16 +55,17 @@ "build": "del-cli lib && tsc",

"devDependencies": {
"@commitlint/cli": "^17.1.2",
"@commitlint/config-conventional": "^17.1.0",
"@commitlint/prompt-cli": "^17.1.2",
"@commitlint/cli": "^17.4.2",
"@commitlint/config-conventional": "^17.4.2",
"@commitlint/prompt-cli": "^17.4.2",
"@sindresorhus/tsconfig": "^3.0.1",
"@types/lodash": "^4.14.186",
"@types/node": "^18.11.3",
"@types/lodash": "^4.14.191",
"@types/node": "^18.11.18",
"@typicode/eslint-config": "^1.1.0",
"del-cli": "^5.0.0",
"eslint": "^8.26.0",
"husky": "^8.0.1",
"eslint": "^8.33.0",
"husky": "^8.0.3",
"lodash": "^4.17.21",
"tempy": "^3.0.0",
"typescript": "^4.8.4",
"xv": "^1.1.1"
"ts-node": "^10.9.1",
"typescript": "^4.9.5",
"xv": "^2.1.1"
},

@@ -70,0 +72,0 @@ "engines": {

@@ -63,5 +63,8 @@ # lowdb [![](http://img.shields.io/npm/dm/lowdb.svg?style=flat)](https://www.npmjs.org/package/lowdb) [![Node.js CI](https://github.com/typicode/lowdb/actions/workflows/node.js.yml/badge.svg)](https://github.com/typicode/lowdb/actions/workflows/node.js.yml)

_Lowdb is a pure ESM package. If you're having trouble importing it in your project, please [read this](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c)._
_Lowdb is a pure ESM package. If you're having trouble using it in your project, please [read this](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c)._
__Next.js__: there's a [known issue](https://github.com/typicode/lowdb/issues/554). Until it's fixed, please use this [workaround](https://github.com/typicode/lowdb/issues/554#issuecomment-1345252506) or lowdb `^4.0.0`.
```js
// Remember to set type: module in package.json or use .mjs extension
import { join, dirname } from 'node:path'

@@ -259,10 +262,10 @@ import { fileURLToPath } from 'node:url'

#### `LocalStorage`
#### `LocalStorage` `SessionStorage`
Synchronous adapter for `window.localStorage`.
Synchronous adapter for `window.localStorage` and `window.sessionStorage`.
```js
import { LocalStorage } from 'lowdb/browser'
import { LocalStorage, SessionStorage } from 'lowdb/browser'
new LowSync(new LocalStorage(name))
new LowSync(new SessionStorage(name))
```

@@ -269,0 +272,0 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc