From 62a3c8fb38febc265c303f5b0f6aa0bf986240ff Mon Sep 17 00:00:00 2001 From: tjcrowder Date: Thu, 10 Sep 2009 15:12:56 +0100 Subject: [PATCH] doc: Merged and updated old docs for Hash#get --- src/lang/hash.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/lang/hash.js b/src/lang/hash.js index 26c79fe..f0ce359 100644 --- a/src/lang/hash.js +++ b/src/lang/hash.js @@ -91,8 +91,22 @@ var Hash = Class.create(Enumerable, (function() { /** * Hash#set(key, value) -> value + * - key (String): The key to use for this value. + * - value (?): The value to use for this key. * - * Sets the hash's `key` property to `value` and returns `value`. + * Stores `value` in the hash using the key `key` and returns `value`. + * + * ### Example + * + * var h = $H(); + * h.keys(); + * // -> [] (initially empty) + * h.set('a', 'apple'); + * // -> "apple" + * h.keys(); + * // -> ["a"] (has the new entry) + * h.get('a'); + * // -> "apple" **/ function set(key, value) { return this._object[key] = value;