Skip to content

Commit

Permalink
Interface shortcut for removeItem(key).
Browse files Browse the repository at this point in the history
  • Loading branch information
brianloveswords committed Jan 12, 2011
1 parent d63273e commit e9c7e89
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/tastystorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@
if (this instanceof arguments.callee) return new StorageWrapper(arguments[0]);
if (arguments.length == 0) return methods.len();
if (arguments.length == 1) return methods.getItem(arguments[0]);
if (arguments.length == 2) return methods.setItem(arguments[0], arguments[1]);
if (arguments.length == 2) {
if (arguments[1] === null) return methods.removeItem(arguments[0]);
return methods.setItem(arguments[0], arguments[1]);
}
return undefined;
});

Expand Down

0 comments on commit e9c7e89

Please sign in to comment.