Imagine a function that deletes a cookie and returns its value.
What would you call it if you have to use a single verb?
I called it clear
but I'm not very fond of the name.
Imagine a function that deletes a cookie and returns its value.
What would you call it if you have to use a single verb?
I called it clear
but I'm not very fond of the name.
It sounds similar to Pop
, except Pop
typically acts on the last element in a collection. Perhaps Extract
could be a suitable name?
I'd do something like this:
public String GetAndDeleteCookie(String cookieName); // C#
function getAndDeleteCookie(cookieName); // JavaScript
get_and_delete_cookie(cookieName); // php (forget exact syntax)
In the Ruby doc for hsh.delete(key)
, their doc is:
"Deletes and returns a key-value pair from hsh whose key is equal to key. If the key is not found, returns the default value."
So deleteCookie
would probably be acceptable, the key is to just document the behavior properly.