set-proto
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