Sha256: c48f0af5ed041bf606d7071bc4c2de9106f071855eec7f8485d71631d62849da
Contents?: true
Size: 582 Bytes
Versions: 4
Compression:
Stored size: 582 Bytes
Contents
/*---[ data structure conveniences ]----------------------------------*/ // Return an array of keys in +hash+. Example: // hash_keys({'foo': 'bar', 'baz': 'qux'}); // ['foo', 'baz'] function hash_keys(hash) { array = new Array(); for (key in hash) { if (key) { array.push(key); } } return array; } // Return hash where each key is an element of the +array+. Example: // array_to_hash(['foo', 'bar']); // {'foo': true, 'bar': true} function array_to_hash(array) { hash = new Array(); for (i in array) { hash[array[i]] = true; } return hash; }
Version data entries
4 entries across 4 versions & 1 rubygems