Created
September 12, 2010 11:07
-
-
Save xulapp/575988 to your computer and use it in GitHub Desktop.
storage
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
var store = (function() { | |
var keys = []; | |
var values = []; | |
return function store(key, value) { | |
var index = keys.indexOf(key); | |
if (1 < arguments.length) { | |
if (index === -1) | |
index = keys.push(key) - 1; | |
values[index] = value; | |
} | |
return values[index]; | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment