File tree Expand file tree Collapse file tree 2 files changed +13
-15
lines changed
Expand file tree Collapse file tree 2 files changed +13
-15
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " node-key-value-storage" ,
3- "version" : " 1.0.1 " ,
3+ "version" : " 1.0.2 " ,
44 "description" : " Create data storage that uses a simple key-value method" ,
55 "main" : " dist/cjs/node-key-value-storage.js" ,
66 "module" : " dist/mjs/node-key-value-storage.js" ,
2222 "prepare-build" : " if exist .\\ dist (echo ok) && mkdir dist && del /S /Q .\\ dist\\ *" ,
2323 "prepare-build-win" : " if not exist .\\ dist (mkdir dist) else (rmdir /S /Q .\\ dist\\ )"
2424 },
25+ "files" : [
26+ " dist/" ,
27+ " LICENSE"
28+ ],
2529 "repository" : {
2630 "type" : " git" ,
2731 "url" : " git+https://github.com/nuzulul/node-key-value-storage.git"
Original file line number Diff line number Diff line change @@ -2,22 +2,16 @@ import fs from 'fs'
22
33export class Nkvs {
44
5- _dataDirName :string
6- _storageName :string
75 _storageDir :string
86
97 private constructor ( {
10- dataDirName = "data" ,
11- storageName
8+ storageDir
129 } :{
13- dataDirName ?: string ,
14- storageName :string
10+
11+ storageDir :string
1512 } ) {
16- if ( ! this . isAlphanumeric ( dataDirName ) ) this . showError ( 'dataDir must be Alphanumeric' )
17- if ( ! this . isAlphanumeric ( storageName ) ) this . showError ( 'namespace must be Alphanumeric' )
18- this . _dataDirName = "./" + dataDirName
19- this . _storageName = storageName
20- this . _storageDir = this . _dataDirName + '/' + storageName
13+
14+ this . _storageDir = storageDir
2115 }
2216
2317 private isAlphanumeric ( str :string ) {
@@ -56,12 +50,12 @@ export class Nkvs{
5650 } )
5751 }
5852
59- if ( ! isAlphanumeric ( dataDirName ) ) showError ( 'dataDir must be Alphanumeric' )
60- if ( ! isAlphanumeric ( storageName ) ) showError ( 'namespace must be Alphanumeric' )
53+ if ( ! isAlphanumeric ( dataDirName ) ) showError ( 'dataDirName must be Alphanumeric' )
54+ if ( ! isAlphanumeric ( storageName ) ) showError ( 'storageName must be Alphanumeric' )
6155 let _dataDirName = "./" + dataDirName
6256 let storageDir = _dataDirName + '/' + storageName
6357 await makeDir ( storageDir )
64- return new Nkvs ( { storageName } )
58+ return new Nkvs ( { storageDir } )
6559 }
6660
6761
You can’t perform that action at this time.
0 commit comments