-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
So I want to run an AppleScript similar to this one:
tell current track
set export to {name:name, album:album, artist:artist}
end tell
Which works just fine, except what is returned is an array ['name:name', 'album:album', etc], rather than a keyed hash.
I've had a look at applescript-parser.js and I think UndefinedParser currently the best place for this:
while (!END_OF_TOKEN.test(cur)) {
if (cur === ':') {
var key = this.value.substring(this.index, end-1);
this.index = end;
var value = parseFromFirstRemaining.call(this);
return {key: key, value: value};
}
cur = this.value[end++];
}
Then, in ArrayParser:
if (next.key) {
rtn[next.key] = next.value;
} else{
rtn.push(next);
}
This does need more work though, because it won't determine if rtn should be an array or hash and that creates issues later.
Metadata
Metadata
Assignees
Labels
No labels