Last active
July 1, 2017 13:51
-
-
Save elenaparaschiv/02227d74e067a11461b38ef7f6c1eee9 to your computer and use it in GitHub Desktop.
completed challange 3 : https://github.com/gordonmzhu/beasts/issues/1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
var libraryStorage = {}; | |
var dependenciesGathered = []; | |
function librarySystem(libraryName, dependencies, callback){ | |
if(arguments.length > 1){ | |
dependencies.forEach(function(dep){ | |
dependenciesGathered.push(libraryStorage[dep]); | |
}); | |
libraryStorage[libraryName] = callback.apply(this, dependenciesGathered); | |
}else{ | |
return libraryStorage[libraryName]; | |
} | |
} | |
window.librarySystem = librarySystem; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment