Check if key exists in array in nunjucks template (Node JS)
I am creating an application in Node Js using the Nunjucks templating engine and I have to apply permissions on the pages to show links, edit and remove links.
For this, I have implemented an array of permissions as shown below:
var user_params = ['add_user', 'edit_user', 'delete_user'];
Now I want to check in the pages that add_user exists in the user_params array or not like we do in php
in_array('add_user', user_params)
But I can accomplish this task in nunjucks. So can anyone help me?
Thank you in advance
+3
source to share