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

extend-context

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

extend-context

like _.bind() or _.bindAll() but extends 'this' instead of replacing it

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-88.89%
Maintainers
1
Weekly downloads
 
Created
Source

extend-context

like _.bind() and _.bindAll() but extends the context (this) instead of replacing it

Usage:

var extendContext = require('extend-context');

var someFunction = function () { console.log(this.foo); }

// someFunction();
// $ undefined

someFunction = extendContext(someFunction, {
  foo: true
  'and you know, the stuff': 82385235,
  I: 93529523,
  want: 2352,
  'to inject into': 'someFunction\'s `this` variable'
});

// someFunction();
// $ true
To do an object of functions all at once (like _.bindAll)
var someObject = {
  foo: function () { ... },
  bar: function () { ... },
  baz: function () { ... }
};
someObject = extendContext.all(someObject, {
  sails: require('sails')
});

// Now I can do:
someObject.foo();
someObject.bar();
someObject.baz();

// And they'll all have access to `sails`.


License

MIT c. Mike McNeil 2014

Keywords

FAQs

Package last updated on 12 Jan 2014

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