Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tabcat/orbit-db-fsstore

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tabcat/orbit-db-fsstore - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

2

package.json
{
"name": "@tabcat/orbit-db-fsstore",
"version": "3.0.0",
"version": "3.0.1",
"description": "a custom orbit-db store representing a file system",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -179,3 +179,5 @@

pathExistNo: (path) => new Error(`path '${path}' does not exist`),
pathExistYes: (path) => new Error(`path '${path}' already exists`)
pathExistYes: (path) => new Error(`path '${path}' already exists`),
pathDirNo: (path) => new Error(`path '${path}' is not a dir`),
pathFileNo: (path) => new Error(`path '${path}' is not a file`)
}

@@ -182,0 +184,0 @@

@@ -16,9 +16,14 @@

const cTypeError = (cType) => cType === fs.cTypes.dir
? errors.pathDirNo
: errors.pathFileNo
const paramChecks = (self) => ({
path: ({ path }) => {
path: ({ path }, cType) => {
if (!pathValid(path)) throw errors.pathValidNo(path)
if (!self.exists(path)) throw errors.pathExistNo(path)
if (self.content(path) !== cType) throw cTypeError(cType)(path)
return true
},
pathName: ({ path, name }) => {
pathName: ({ path, name }, cType) => {
if (!pathValid(path)) throw errors.pathValidNo(path)

@@ -28,5 +33,6 @@ if (!nameValid(name)) throw errors.nameValidNo(name)

if (self.exists(joinPath(path, name))) throw errors.pathExistYes(joinPath(path, name))
if (self.content(path) !== fs.cTypes.dir) throw errors.pathDirNo(path)
return true
},
pathDestName: ({ path, dest, name }) => {
pathDestName: ({ path, dest, name }, cType) => {
if (!pathValid(path)) throw errors.pathValidNo(path)

@@ -38,2 +44,4 @@ if (!pathValid(dest)) throw errors.pathValidNo(dest)

if (self.exists(joinPath(dest, name))) throw errors.pathExistYes(joinPath(dest, name))
if (self.content(path) !== cType) throw cTypeError(cType)(path)
if (self.content(dest) !== fs.cTypes.dir) throw errors.pathDirNo(dest)
return true

@@ -79,3 +87,4 @@ },

_addOp ({ op, ...payload }) {
this.paramChecks[paramKeys[op]](payload)
const cType = op.slice(-3) === 'DIR' ? fs.cTypes.dir : fs.cTypes.file
this.paramChecks[paramKeys[op]](payload, cType)
return this._addOperation({ op, ...payload })

@@ -82,0 +91,0 @@ }

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