json - Evaluate custom javascript method (CircularJSON) with Jade -


i want parse object client-side javascript through jade. work:

script var object = json.parse(#{json.stringify(object)}); 

but object circular , need this

script var object = circularjson.parse(#{circularjson.stringify(object)}); 

but throws error

cannot call method 'stringify' of undefined

which guess because jade doesn't recognise circularjson method. way make it?

it required , passed in locals

response.render("index.jade", {circularjson : require('circular-json')}); 

or defined function in scope of jade

- var circularjson = function(e,t){function l(e,t,o){var u=[],...//whole function script var player = circularjson.parse('!{circularjson.stringify(player)}'); 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -