Repository navigation
Open
Description
I tried something that was not documented: "Iterate over an object"
code:
<script type="text/hyperscript">
init
set $o to { name: "john", age: 30 }
for value in $o index key
log key
log value
end
end
</script>
But I could not get it working. Trying multiple methods, most of them resulted into an error.
console:
Uncaught TypeError: i.iterator is undefined
op https://unpkg.com/hyperscript.org:1
unifiedEval https://unpkg.com/hyperscript.org:1
unifiedExec https://unpkg.com/hyperscript.org:1
execute https://unpkg.com/hyperscript.org:1
o https://unpkg.com/hyperscript.org:1
setTimeout handler*install https://unpkg.com/hyperscript.org:1
apply https://unpkg.com/hyperscript.org:1
initElement https://unpkg.com/hyperscript.org:1
processNode https://unpkg.com/hyperscript.org:1
forEach https://unpkg.com/hyperscript.org:1
processNode https://unpkg.com/hyperscript.org:1
w https://unpkg.com/hyperscript.org:1
n https://unpkg.com/hyperscript.org:1
w https://unpkg.com/hyperscript.org:1
promise callback*w https://unpkg.com/hyperscript.org:1
<anonymous> https://unpkg.com/hyperscript.org:1
<anonymous> https://unpkg.com/hyperscript.org:1
Since this works in normal javascript I think there must be a way to do this in hyperscript.
Please let me know how to do this.
Metadata
Metadata
Assignees
Labels
No labels
Activity
1cg commentedon Jun 16, 2025
Right now there is nothing in raw hyperscript for this, you have to use https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys.
I could look at a language feature for this though.