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

ssb-crut

Package Overview
Dependencies
Maintainers
3
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ssb-crut - npm Package Compare versions

Comparing version 4.3.1 to 4.4.0

13

index.js

@@ -212,8 +212,11 @@ const Strategy = require('@tangle/strategy')

// map rootMsg => record (and filter out the ones which were junk)
pull.asyncMap((msg, cb) => {
this.read(msg.key, (err, record) => {
if (err) cb(null, false)
else cb(null, record)
pull.asyncMap(
opts.read ||
((msg, cb) => {
this.read(msg.key, (err, record) => {
if (err) cb(null, false)
else cb(null, record)
})
})
}),
),
pull.filter(Boolean),

@@ -220,0 +223,0 @@

{
"name": "ssb-crut",
"version": "4.3.1",
"version": "4.4.0",
"description": "easy CRUT methods for secure scuttlebutt",

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

@@ -317,2 +317,13 @@ # ssb-crut

- only show tombstoned records
- `opts.read` *Function*
- provide a custom 'read' function which allows e.g. decorating, or installing a cache
- default:
```js
(msg, cb) => {
crut.read(msg.key, (err, record) => {
if (err) cb(null, null) // prevents one failed read from causing whole like to fail
else cb(null, record)
})
}
```

@@ -319,0 +330,0 @@ ---

@@ -97,2 +97,22 @@ const test = require('tape')

/* opts.read */
list = await crut.list({
read: (msg, cb) => {
crut.read(msg.key, (err, record) => {
if (err) return cb(null, null)
record.fancyName = 'fancy-' + record.name
delete record.states
cb(null, record)
})
}
// we provide a custom read which adjusts
// but could also check a cache etc
})
t.deepEqual(
list.map(record => record.fancyName),
['fancy-0', 'fancy-3', 'fancy-2', 'fancy-1'],
'opts.read'
)
// tombstone

@@ -99,0 +119,0 @@ await crut.tombstone(recordId, {})

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