cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Referencing snap, pipe variables from within an expression library

omair
Contributor

Iโ€™m trying to create an expression library function that needs access to both the snap and pipe variables. Can these variables be accessed directly from within the expression library function or must they be passed in as parameters?

Right now my function looks like this:

getHeader: (name) =>
   match(pipe.flags.immediate_mode) {
      true  => snap.original.load().get(name),
      _     => pipe.get("args",{}).get(name)
}

When I run this pipeline, I get the following error:

{"error":"snap is undefined.  Perhaps you meant: isNaN, jsonPath, JSON, String, _personsURL, parseInt","reason":null,"resolution":"Check the spelling of the variable"}
1 REPLY 1

ptaylor
Employee
Employee

It looks like you have to pass in snap and probably pipe as parameters.