Giter VIP home page Giter VIP logo

extend's Introduction

Extend

Javascript extend function used to easily allow for pseudo inheritance prior to ES6.

Preface

Extend is a Object Oriented Javascript facade for creating inhertiance like behavior with Javascript objects. It works very similarly to jQuery.extend which was the inital inspiration for the creation of the micro framework. The micro framework was created as a polyfill for users like me who like extend but don't want everything else that comes along with jQuery.

Example

  • Example of adding properties to a Javascript object.
var animal = {"name" : "spot"};
var dog = {"bark" : function(){alert("woof");}, "dig" : function(){yard.destory();}};
extend(dog, animal);

The object dog would look like {"name" : "spot", "bark" : function(){...}, "dig" : function(){...}, "super" : {...}}

  • Example of overriding properties of a Javascript object.
var alertSystem = {"alert" : function(){console.log("Hello world!")}};
var upgradedAlertSystem = {"alert" : function(){alert("Hello world!")}};
extend(alertSystem, upgradedAlertSystem);

The object alertSystem would have the same function as the upgradedAlertSystem.

License

The MIT License

extend's People

Contributors

cogwizzle avatar

Watchers

 avatar

extend's Issues

Base class definition

Needs to keep track of base class definition so that it can call base class functions internally.

Update readme

As a developer I would like the readme examples on the main page to be updated to show the new super functionality.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.