Closed schmarjames closed 8 years ago
Is there a case when data is not removed?
If the data isn't removed it will return false. The localStorage function "getItem" will return null if the key doesn't exist. Anything else means that the key still exist and the function will return false.
In any case if the user passes a key that does exist in the local storage it will be removed. This is just a way to determine if the remove was successful. The function ls.remove('keyName') can be passed to an if/else conditional. Besides the documentation states that it will return a boolean yet it doesn't.
You didn't answer my question, though
The answer to your question is no.
Modified remove function to return a boolean based on the success of removing a key from the local storage. This could be a convenience syntax wise to simply check if data has been removed.