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.1.4 to 3.1.5

2

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

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

@@ -14,2 +14,4 @@ [![npm (scoped)](https://img.shields.io/npm/v/@tabcat/orbit-db-fsstore)](https://www.npmjs.com/package/@tabcat/orbit-db-fsstore)

##### Credit [File system on CRDT; Mehdi Ahmed-Nacer, Stéphane Martin, Pascal Urso](https://arxiv.org/pdf/1207.5990.pdf) for filesystem datatype and operation structure
## FSStore Instance Methods API

@@ -16,0 +18,0 @@ *check out [./test](./test) for more info*

@@ -39,7 +39,10 @@

const pathPattern = /^(?:\/[^/]+)+$/
const pathValid = (path) => typeof path === 'string' && pathPattern.test(path)
const namePattern = /^[^/]+$/
const nameValid = (name) => typeof name === 'string' && namePattern.test(name)
const namePatternInfo = `match any string that does not contain '/'; regx: ${namePattern}`
const pathPattern = /^(?:\/[^/]+)+$/
const pathValid = (path) => typeof path === 'string' && pathPattern.test(path)
const pathPatternInfo = `match any string that is made of '/' + <name>; regx: ${pathPattern}`
function joinPath (path, name) {

@@ -53,5 +56,10 @@ if (!pathValid(path)) throw errors.pathValidNo(path)

if (!pathValid(path)) throw errors.pathValidNo(path)
return path.split('/')[path.split('/').length - 1]
return path.slice(path.lastIndexOf('/') + 1)
}
function baseName (path) {
if (!pathValid(path)) throw errors.pathValidNo(path)
return path.slice(0, Math.max(path.lastIndexOf('/'), 0))
}
const isOver = (p1, p2) => `${p1}/` === p2.slice(0, p1.length + 1)

@@ -188,4 +196,4 @@ const isOneHigher = (p1, p2) => p1.split('/').length + 1 === p2.split('/').length

const errors = {
pathValidNo: (path) => new Error(`path ${path} is not valid`),
nameValidNo: (name) => new Error(`name ${name} is not valid`),
pathValidNo: (path) => new Error(`path ${path} is not valid, ${pathPatternInfo}`),
nameValidNo: (name) => new Error(`name ${name} is not valid, ${namePatternInfo}`),
pathExistNo: (path) => new Error(`path '${path}' does not exist`),

@@ -227,3 +235,4 @@ pathExistYes: (path) => new Error(`path '${path}' already exists`),

joinPath,
pathName
pathName,
baseName
}
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