Wondering if I could build a Hash object using beestings I built this test
ruleset a60x522 {
meta {
name "hash-beesting-test"
description <<
hash-beesting-test
>>
author "Mike Grace"
logging on
}
rule tester {
select when pageview ".*"
pre {
phone = 23423423;
name = "Mike Grace";
year = 1999;
month = "December";
userData = {
"#{phone}": {
"name": "#{name}",
"year": {
"#{year}": {
"month": {
"#{month}": {
"awesome": "yes!"
}
}
}
}
}
};
}
{
emit <|
console.log(userData);
|>;
}
}
}
- 15-18 set variables for use in beestings in hash
- 20-33 hash object
- 21 setting key in hash with beesting value of ‘phone’
- 38 print to the console what the hash object looks like
Console output after running app on example.com with bookmarklet
Note: Using the variables in place of putting them in a beesting also works.
Get the bookmarklet to try it out yourself!
Gratuitous day 27 Grace face

