Skip to content

Instantly share code, notes, and snippets.

@splinter
Last active December 21, 2015 04:29
Show Gist options
  • Save splinter/6249520 to your computer and use it in GitHub Desktop.
Save splinter/6249520 to your computer and use it in GitHub Desktop.
Basic usage of the snoop helper
var context={
fruits:[
{
name:'apples',
label:'I like salted apples',
value:'1',
info:{
some_data:'Have some more apples!'
}
},
{
name:'oranges',
label:'I don't like oranges',
value:'2'
},
{
name:'tomatoes',
label:'Tomatoes are yummy!',
value:'3'
}
]
}
Basic Usage:
{{{ snoop "fruits(name=apples).value" context }}} = 1
{{{ snoop "fruits(name=oranges).label" context }}} = I don't like oranges
{{{ snoop "fruits(name=apples).info.some_data" context }}} = Have some more apples
{{{ snoop "fruits(value=3).name" context }}} = tomatoes
Invalid path expressions will return an empty string ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment