@f/set-proto

1.0.1 • Public • Published

set-proto

Build status Git tag NPM version Code style

Set the proto of an object.

Installation

$ npm install @f/set-proto

Usage

var setProto = require('@f/set-proto')

var man = {talk: () => 'hello'}
var cat = {talk: () => 'meow'}
var obj = {}

setProto(man, obj)
obj.talk() // => 'hello'
setProto(cat, obj)
obj.talk() // => 'meow'

API

setProto(proto, obj)

  • proto - The object's new prototype.
  • obj - The object which is to have its prototype set.

Returns: obj

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @f/set-proto

Weekly Downloads

12

Version

1.0.1

License

MIT

Last publish

Collaborators

  • f