How to use the pull-stream.filter function in pull-stream

To help you get started, we’ve selected a few pull-stream examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ipfs / js-ipfs-unixfs-engine / src / exporter / resolve.js View on Github external
return cb(null, resolveItem(null, item.object, item, options.offset, options.length))
      }

      const cid = new CID(item.multihash)

      dag.get(cid, (err, node) => {
        if (err) {
          return cb(err)
        }

        // const name = item.fromPathRest ? item.name : item.path
        cb(null, resolveItem(cid, node.value, item, options.offset, options.length))
      })
    }),
    pull.flatten(),
    pull.filter(Boolean),
    pull.filter((node) => node.depth <= options.maxDepth)
  )

  function resolveItem (cid, node, item, offset, length) {
    return resolve(cid, node, item.name, item.path, item.pathRest, item.size, dag, item.parent || parent, item.depth, offset, length)
  }

  function resolve (cid, node, name, path, pathRest, size, dag, parentNode, depth, offset, length) {
    let type

    try {
      type = typeOf(node)
    } catch (error) {
      return pull.error(error)
    }
github blockades / scuttle-dark-crystal / root / pull / mine.js View on Github external
const query = [{
      $filter: {
        value: {
          author: server.id,
          timestamp: { $gt: 0 }, // needed for how I set up /query page
          content: { type: 'dark-crystal/root' }
        }
      }
    }]

    const _opts = Object.assign({}, { query }, opts)
    // NOTE - this could benefit from a deeper merge?

    return pull(
      next(server.query.read, _opts),
      pull.filter(isRoot)
    )
  }
}
github mmckegg / patchwork-next / old_modules / notifications.js View on Github external
function unbox () {
  return pull(
    pull.map(function (msg) {
      return msg.value && typeof msg.value.content === 'string'
        ? message_unbox(msg)
        : msg
    }),
    pull.filter(Boolean)
  )
}

pull-stream

minimal pull stream

MIT
Latest version published 1 year ago

Package Health Score

60 / 100
Full package analysis

Similar packages