Skip to content

Instantly share code, notes, and snippets.

@kirkouimet
Created August 26, 2016 06:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kirkouimet/856492387755f34800759bef2661355f to your computer and use it in GitHub Desktop.
Save kirkouimet/856492387755f34800759bef2661355f to your computer and use it in GitHub Desktop.
implement = function(classToReceiveImplementation, classToImplement) {
for(var classToImplementProperty in classToImplement) {
if(classToReceiveImplementation[classToImplementProperty] === undefined) {
//console.log(classToImplementProperty, 'does not exist on class, copying');
classToReceiveImplementation[classToImplementProperty] = cloneProperty(classToImplement[classToImplementProperty]);
}
}
for(var classToImplementPrototypeProperty in classToImplement.prototype) {
if(classToReceiveImplementation.prototype[classToImplementPrototypeProperty] === undefined) {
//console.log(classToImplementPrototypeProperty, 'does not exist on class prototype, copying');
classToReceiveImplementation.prototype[classToImplementPrototypeProperty] = cloneProperty(classToImplement.prototype[classToImplementPrototypeProperty]);
}
}
return classToReceiveImplementation;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment