Skip to content

Commit

Permalink
pref : remove unused variable
Browse files Browse the repository at this point in the history
  • Loading branch information
nuzulul committed Jan 26, 2024
1 parent b8eb9d8 commit 2d3f35d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-key-value-storage",
"version": "1.0.1",
"version": "1.0.2",
"description": "Create data storage that uses a simple key-value method",
"main": "dist/cjs/node-key-value-storage.js",
"module": "dist/mjs/node-key-value-storage.js",
Expand All @@ -22,6 +22,10 @@
"prepare-build": "if exist .\\dist (echo ok) && mkdir dist && del /S /Q .\\dist\\*",
"prepare-build-win": "if not exist .\\dist (mkdir dist) else (rmdir /S /Q .\\dist\\)"
},
"files": [
"dist/",
"LICENSE"
],
"repository": {
"type": "git",
"url": "git+https://github.com/nuzulul/node-key-value-storage.git"
Expand Down
22 changes: 8 additions & 14 deletions src/node-key-value-storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,16 @@ import fs from 'fs'

export class Nkvs{

_dataDirName:string
_storageName:string
_storageDir:string

private constructor({
dataDirName = "data",
storageName
storageDir
}:{
dataDirName?:string,
storageName:string

storageDir:string
}){
if(!this.isAlphanumeric(dataDirName))this.showError('dataDir must be Alphanumeric')
if(!this.isAlphanumeric(storageName))this.showError('namespace must be Alphanumeric')
this._dataDirName = "./"+dataDirName
this._storageName = storageName
this._storageDir = this._dataDirName+'/'+storageName

this._storageDir = storageDir
}

private isAlphanumeric(str:string) {
Expand Down Expand Up @@ -56,12 +50,12 @@ export class Nkvs{
})
}

if(!isAlphanumeric(dataDirName))showError('dataDir must be Alphanumeric')
if(!isAlphanumeric(storageName))showError('namespace must be Alphanumeric')
if(!isAlphanumeric(dataDirName))showError('dataDirName must be Alphanumeric')
if(!isAlphanumeric(storageName))showError('storageName must be Alphanumeric')
let _dataDirName = "./"+dataDirName
let storageDir = _dataDirName+'/'+storageName
await makeDir(storageDir)
return new Nkvs({storageName})
return new Nkvs({storageDir})
}


Expand Down

0 comments on commit 2d3f35d

Please sign in to comment.