Sorry about that, my default is terse (influenced by Postel's
conservative:send::liberal:receive, and Strunk/White, and BNF
(anyway...)).
I'd like to be able to define 'object comprehensions' like array
comprehensions, in JavaScript, with key:values ({}) instead of values
([]).
Maybe it's a Python itch?
As pointed out; because literal keys are required, the object syntax
might be tricky. While thinking about intermediates (like the key
array as well as the entire {} being returned (basically a copy of
localStorage)) and data sizes (localStorage might be 5M or more),
using __iterator__() seemed like a viable approach (much more on
demand, limiting data fluff) and is compatible with [key, value] <-
Iterator( foo ) syntax (behaving like a {} value, on the 'client'
side). In the __iterator__() code mentioned, I've moved the 'key'
declaration outside the loop and wrapped the return value in an
Iterator, which allows for code like for( let [key, val] in
getLocalStorageKeyValues() ) {...} (the function name was also
refactored)) on the 'client' side, and am happy now with the
implementation (and 'client' API). If only localStorage permissions
(in Firefox 3.6) weren't so quirky...
https://bugzilla.mozilla.org/show_bug.cgi?id=542730
--
G