From 71e07f0efa6dbb4fa2d53647b4c28276ffae246d Mon Sep 17 00:00:00 2001 From: tjcrowder Date: Thu, 10 Sep 2009 15:39:34 +0100 Subject: [PATCH] doc: Merged and updated old docs for Hash#unset. --- src/lang/hash.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/lang/hash.js b/src/lang/hash.js index 21e2b5f..3f71de7 100644 --- a/src/lang/hash.js +++ b/src/lang/hash.js @@ -132,7 +132,18 @@ var Hash = Class.create(Enumerable, (function() { /** * Hash#unset(key) -> value * - * Deletes the hash's `key` property and returns its value. + * Deletes the stored pair for the given `key` from the hash and returns its + * value. + * + * ### Example + * + * var h = new Hash({a: 'apple', b: 'banana', c: 'coconut'}); + * h.keys(); + * // -> ["a", "b", "c"] + * h.unset('a'); + * // -> 'apple' + * h.keys(); + * // -> ["b", "c"] ("a" is no longer in the hash) **/ function unset(key) { var value = this._object[key];