Skip to content

dominictarr/pull-markable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pull-markable

A pull-stream that you can mark, read ahead, and then jump back to the marked point.

Used in [regular-stream] (https://github.com/dominictarr/regular-stream)

Example

var markable = require('pull-markable')

var read = pull.values([1, 2, 3]).pipe(markable)

var revert = read.mark()

read(null, function (end, data) {
  console.log(data) //=> 1
   //data = 1
  read(null, function (end, data) {
    console.log(data) //=> 2
    //revert takes us back to 1!
    revert()
    read(null, function (end, data) {
      console.log(data) //=> 1 !
    })
  })
})

todo

release old marks, and probably also capture groups.

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published