fastkv 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.d.mts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<img src="https://jvk6hm88bttdy90i.public.blob.vercel-storage.com/fastkv.png" width="400"
|
|
2
|
+
<img src="https://jvk6hm88bttdy90i.public.blob.vercel-storage.com/fastkv-transparent.png" width="400"/>
|
|
3
3
|
</div>
|
|
4
4
|
|
|
5
5
|
# FastKV
|
package/dist/index.d.mts
CHANGED
|
@@ -14,25 +14,25 @@ declare class KV<T = any> {
|
|
|
14
14
|
* Sets a value to a key.
|
|
15
15
|
* @param key - The name of the key.
|
|
16
16
|
* @param value - The value to store.
|
|
17
|
-
* @returns
|
|
17
|
+
* @returns The value.
|
|
18
18
|
*/
|
|
19
|
-
set(key: string, value: T):
|
|
19
|
+
set(key: string, value: T): T;
|
|
20
20
|
/**
|
|
21
21
|
* Gets data by a key.
|
|
22
22
|
* @param key - The existing key's name.
|
|
23
|
-
* @returns
|
|
23
|
+
* @returns The found data, or null.
|
|
24
24
|
*/
|
|
25
|
-
get(key: string):
|
|
25
|
+
get(key: string): T | null;
|
|
26
26
|
/**
|
|
27
27
|
* Gets all data in the store.
|
|
28
|
-
* @returns
|
|
28
|
+
* @returns An array of data.
|
|
29
29
|
*/
|
|
30
|
-
all():
|
|
30
|
+
all(): T[];
|
|
31
31
|
/**
|
|
32
32
|
* Clears all data in the store.
|
|
33
|
-
* @returns
|
|
33
|
+
* @returns The KV instance.
|
|
34
34
|
*/
|
|
35
|
-
clear():
|
|
35
|
+
clear(): this;
|
|
36
36
|
}
|
|
37
37
|
declare const _default: KV<any>;
|
|
38
38
|
|
package/dist/index.d.ts
CHANGED
|
@@ -14,25 +14,25 @@ declare class KV<T = any> {
|
|
|
14
14
|
* Sets a value to a key.
|
|
15
15
|
* @param key - The name of the key.
|
|
16
16
|
* @param value - The value to store.
|
|
17
|
-
* @returns
|
|
17
|
+
* @returns The value.
|
|
18
18
|
*/
|
|
19
|
-
set(key: string, value: T):
|
|
19
|
+
set(key: string, value: T): T;
|
|
20
20
|
/**
|
|
21
21
|
* Gets data by a key.
|
|
22
22
|
* @param key - The existing key's name.
|
|
23
|
-
* @returns
|
|
23
|
+
* @returns The found data, or null.
|
|
24
24
|
*/
|
|
25
|
-
get(key: string):
|
|
25
|
+
get(key: string): T | null;
|
|
26
26
|
/**
|
|
27
27
|
* Gets all data in the store.
|
|
28
|
-
* @returns
|
|
28
|
+
* @returns An array of data.
|
|
29
29
|
*/
|
|
30
|
-
all():
|
|
30
|
+
all(): T[];
|
|
31
31
|
/**
|
|
32
32
|
* Clears all data in the store.
|
|
33
|
-
* @returns
|
|
33
|
+
* @returns The KV instance.
|
|
34
34
|
*/
|
|
35
|
-
clear():
|
|
35
|
+
clear(): this;
|
|
36
36
|
}
|
|
37
37
|
declare const _default: KV<any>;
|
|
38
38
|
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var a=Object.create;var e=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty;var y=(r,t)=>{for(var i in t)e(r,i,{get:t[i],enumerable:!0})},o=(r,t,i,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of p(t))!d.call(r,s)&&s!==i&&e(r,s,{get:()=>t[s],enumerable:!(c=m(t,s))||c.enumerable});return r};var l=(r,t,i)=>(i=r!=null?a(f(r)):{},o(t||!r||!r.__esModule?e(i,"default",{value:r,enumerable:!0}):i,r)),g=r=>o(e({},"__esModule",{value:!0}),r);var b={};y(b,{KV:()=>n,default:()=>T});module.exports=g(b);var h=l(require("fs")),u=l(require("path")),n=class{#t;#r;constructor(t="::memory::"){this.#t=t,this.#r={},t!="::memory::"&&(this.#t=u.default.resolve(process.cwd(),this.#t),this.#r=this.#s())}#s(){if(this.#t==="::memory::")return{};try{let t=h.default.readFileSync(this.#t,"utf8");return JSON.parse(t)||{}}catch{return{}}}#i(){this.#t!=="::memory::"&&h.default.writeFileSync(this.#t,JSON.stringify(this.#r),"utf8")}set(t,i){return this.#r[t]=i,this.#i(),i}get(t){return this.#r[t]??null}all(){return Object.values(this.#r)}clear(){return this.#r={},this.#i(),this}},T=new n;0&&(module.exports={KV});
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import s from"node:fs";import e from"node:path";var r=class{#t;#r;constructor(t="::memory::"){this.#t=t,this.#r={},t!="::memory::"&&(this.#t=e.resolve(process.cwd(),this.#t),this.#r=this.#s())}#s(){if(this.#t==="::memory::")return{};try{let t=s.readFileSync(this.#t,"utf8");return JSON.parse(t)||{}}catch{return{}}}#i(){this.#t!=="::memory::"&&s.writeFileSync(this.#t,JSON.stringify(this.#r),"utf8")}set(t,i){return this.#r[t]=i,this.#i(),i}get(t){return this.#r[t]??null}all(){return Object.values(this.#r)}clear(){return this.#r={},this.#i(),this}},u=new r;export{r as KV,u as default};
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fastkv",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
7
|
"description": "A key-value store, helpful for caches in apps.",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
|
+
"repository": {
|
|
10
|
+
"url": "https://github.com/m1-dev/fastkv"
|
|
11
|
+
},
|
|
9
12
|
"keywords": [
|
|
10
13
|
"kv",
|
|
11
14
|
"database",
|
|
@@ -20,6 +23,7 @@
|
|
|
20
23
|
},
|
|
21
24
|
"scripts": {
|
|
22
25
|
"build": "tsup",
|
|
23
|
-
"lint": "tsc --noEmit true"
|
|
26
|
+
"lint": "tsc --noEmit true",
|
|
27
|
+
"prepublish": "pnpm run build"
|
|
24
28
|
}
|
|
25
29
|
}
|