Skip to content

An npm package for a very basic object extender library used by .call()ing it on an object and passing in the object to extend it with. Designed as an npm package.

Notifications You must be signed in to change notification settings

nickmeldrum/basic-object-extend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basic-Object-Extend

A very small and simplistic function for extending a JS object. There are lots out there, but this one is possibly unique in that it's typical usage is to call it using call/ apply or bind as it operates on the 'this' object. This may or may not be a good thing, but you now have a choice whether to use this package or one that doesn't do this!

Thanks to the great article: https://quickleft.com/blog/creating-and-publishing-a-node-js-module/ on how to build out an publish an npm module.

Installation

npm install basic-object-extend

Usage

var extend = require('basic-object-extend');
var originalObject = {};

extend.call(originalObject, {"newProp": "oh hai there"});
console.log(originalObject.newProp);

Tests

npm test

About

An npm package for a very basic object extender library used by .call()ing it on an object and passing in the object to extend it with. Designed as an npm package.

Resources

Stars

Watchers

Forks

Packages