Created
August 19, 2015 13:11
-
-
Save kulakowka/3c95b202e0fa86872cb2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 checkPermission(func) { | |
return function() { | |
if (isAdmin()) return func.apply(this, arguments); | |
console.log('Нет прав'); | |
}; | |
} | |
function isAdmin() { | |
return false; | |
} | |
function save() { | |
console.log('saved'); | |
} | |
var save = checkPermission(save); | |
save(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment