New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

scuttlebutt-schema

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scuttlebutt-schema

Tools for creating scuttlebutts.

latest
Source
npmnpm
Version
1.2.1
Version published
Maintainers
1
Created
Source

scuttlebutt-schema

Tools for creating scuttlebutts.

server-tests

browser-support

schema

var schema = require('scuttlebutt-schema')
var Model  = require('scuttlebutt/model')
var Events = require('scuttlebutt/events')

var createScuttlebutt = schema({
  model: function () {
    return new Model()
  },
  events: function () {
    neturn new Events()
  }
})

//keys are matched on the prefix.
var model1 = createScuttlebutt('model1')
var model2 = createScuttlebutt('model2')
var events1 = createScuttlebutt('events1')

open

open loads a scuttlebutt via a stream. given a schema, and a createStream function, open returns a async function that will callback a fully loaded scuttlebutt. the createStream function takes a string, just like schema, and should return a stream to a scuttlebutt instance with the same name, or a file where that scuttlebutt instance is persisted.

var open = require('scuttlebutt-schema').open(schema, createStream)
//now call the function with a name.
open(name, function (err, sb) {
  //sb is now ready to use!
})

full example


var makeOpen = require('scuttlebutt-schema').open

var open = makeMake(function (name) {
  //return a scuttlebutt.
  return new Model()
}, function (name) {
  //return a duplex stream...
  return http.get('http://whatever.com/replicate/'+name)
})

open(name, function (_, scuttlebutt) {
  //scuttlebutt is ready!
})


## License

MIT

FAQs

Package last updated on 11 Jan 2013

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