🚀 Launch Week Day 3:Introducing Supply Chain Attack Campaigns Tracking.Learn More →
Socket
Book a DemoInstallSign in
Socket

delegate-object

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

delegate-object

Copy properties from an object to another object, where properties with function values will be invoked in the context of the receiver, and properties with non-function values are just copied.

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
2
Created
Source

delegate-object NPM version Build Status

Copy properties from an object to another object, where properties with function values will be invoked in the context of the receiver, and properties with non-function values are just copied.

Install with npm

$ npm i delegate-object --save

Usage

var delegateObject = require('delegate-object');

API

delegate

Copy properties from an object to another object, where properties with function values will be invoked in the context of the receiver, and properties with non-function values are just copied.

Params

  • receiver {Object}: Object to receive properties.
  • provider {Object}: Object providing properties.
  • keys {Array}: Optional array of keys to delegate.
  • returns {Object}: Modified receiver object with properties from provider

Example

var receiver = {};
var provider = {
  name: 'provider',
  upper: function (str) {
    return '[' + this.name + '] ' + str.toUpperCase();
  }
};
var receiver = delegate(receiver, provider);
receiver.name = 'receiver';
console.log(receiver.upper('foo'));
//=> [receiver] FOO

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Brian Woodward

License

Copyright © 2015 Brian Woodward Released under the MIT license.

This file was generated by verb-cli on August 07, 2015.

FAQs

Package last updated on 07 Aug 2015

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