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

object-cursor-stream

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-cursor-stream

de-duped keypath stream

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

object-cursor-stream

de-duped keypath stream

Build Status npm install

Example

var cursorStream = require('object-cursor-stream')

var cursor = cursorStream('pokemon.name')

cursor.write({pokemon: {type: 'chansey', name: 'Dr. Chansey'}}) // 'Dr. Chansey'
cursor.write({pokemon: {type: 'pikachu', name: 'Dr. Chansey'}}) // *nothing emitted*
cursor.write({pokemon: {type: 'pikachu', name: 'Prof. Oak'}}) // 'Prof. Oak'
cursor.write({pokemon: {type: 'pikachu'}}) // undefined

var cursor2 = cursorStream('pokemon.name', 'Spike')

cursor2.write({pokemon: {type: 'chansey', name: 'Dr. Chansey'}}) // 'Dr. Chansey'
cursor2.write({pokemon: {type: 'pikachu', name: 'Dr. Chansey'}}) // *nothing emitted*
cursor2.write({pokemon: {type: 'pikachu', name: 'Prof. Oak'}}) // 'Prof. Oak'
cursor2.write({pokemon: {type: 'pikachu'}}) // 'Spike'

API

cursorStream(keypath[, fallback]) -> DuplexStream

  • keypath is a string representing a path to the data you want from the written data.
  • fallback is an optional argument that will be emitted if the data at keypath is undefined.

License

This project is licensed under the Apache License, Version 2.0. See LICENSE for the full license.

Keywords

FAQs

Package last updated on 15 May 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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