New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

blocpkg

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blocpkg

[WIP] BlocPkg is a reusable code module

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

BlocPkg

BlocPkg is the module you use to build create a blocpkg.

A blocpkg is a package of blocs of code. A bloc is:

  • a single unit of executable code
  • validates input
  • has tests
  • includes documentation
  • returns bloc types for discovery

Usage

const blocpkg = require('blocpkg')
module.exports = blocpkg({
  docs: fs.readFileSync('./README.md', 'utf-8'),
  blocs: {
    MYBLOC: {
      validate: payload => true,
      exec: payload => Promise.resolve({ text: 'OK'}),
      test: payload => true
    }
  }
})

You can create your bloc then publish it on npm, lets say you call it blocpkg-mybloc

** using the blocpkg prefix will make sure your bloc is discoverable by other bloc users.

Consumer

  const bus = require('nanobus')()
  const mybloc = require('blocpkg-mybloc')
  // no config
  const { blocs } = mybloc.register(null, bus)

  // ...
  const exec = require('bloc-promise')(bus)
  exec(blocs.MYBLOC, { hello: 'world' })
    .then(res => {
      if (res.ok) {
        console.log(res.text)
      }
    })

Getting Started

...

Keywords

FAQs

Package last updated on 17 May 2017

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