Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

delega

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

delega

Concise creation of delegate methods for your classes/objects

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Synopsis

Concise creation of delegate methods for your classes/objects

NPM

Build Status Coverage Status

browser support

Usage

For objects

var objA = {
  foo: function() {
    return "a";
  },
  foo2:  function() {
    return "b";
  }
};

var objB = {};
delega.delegateToObject(objB, objA, ['foo','foo2']);

expect(objB.foo()).to.be.equal("a");
expect(objB.foo2()).to.be.equal("b");

For classes

var objA = {
  foo: function() {
    return "a";
  },
  foo2: function() {
    return "b";
  }
};

var clazzB = function() {
  this.a = objA;
};

delega.delegateToProperty(objB, 'a', ['foo', 'foo2']);

expect(new clazzB().foo()).to.be.equal("a");
expect(new clazzB().foo2()).to.be.equal("b");

Bitdeli Badge

Keywords

FAQs

Package last updated on 06 Jun 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