mirror of
https://github.com/cse110-fa22-group29/cse110-fa22-group29.git
synced 2024-12-28 01:39:09 +00:00
3043c6e157
move sample helper functions for localStorage unit testing Signed-off-by: Arthur Lu <learthurgo@gmail.com>
17 lines
343 B
JavaScript
17 lines
343 B
JavaScript
module.exports = {saveToLocal, getFromLocal, removeFromLocal, clearLocal};
|
|
|
|
function saveToLocal (k, v) {
|
|
window.localStorage.setItem(k, v);
|
|
}
|
|
|
|
function getFromLocal (k) {
|
|
return window.localStorage.getItem(k);
|
|
}
|
|
|
|
function removeFromLocal (k) {
|
|
window.localStorage.removeItem(k);
|
|
}
|
|
|
|
function clearLocal () {
|
|
window.localStorage.clear();
|
|
}
|