extend-proto

0.0.1 • Public • Published

extend-proto

NPM Version NPM Downloads Node.js Version Build Status Test Coverage

A utility to inject a prototype chain, fully generic and adaptable.

This largely exists for performance. Injecting a single prototype with many properties on it has been historically faster than adding those properties to an existing instance.

var http = require('http')
var proto = require('extend-proto')
 
var proto = Proto({
    req: http.IncomingMessage,
    res: http.ServerResponse
})
proto.req.defineProperty('kittens', { value: 'the best' })
 
http.createServer(function(req, res) {
  proto(req, res)
 
  req.kittens // the best
})
 

MIT Licensed

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.1
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.1
    2
  • 0.0.0
    0

Package Sidebar

Install

npm i extend-proto

Weekly Downloads

2

Version

0.0.1

License

MIT

Last publish

Collaborators

  • fishrock123