Guest User

Untitled

a guest
Jun 22nd, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. var valRule = {p1 : {
  2. "validation" : true,
  3. "id" : 'string',
  4. "name" : 'string',
  5.  
  6. },
  7. p2 : {
  8. "validation" : true,
  9. "name" : 'string',
  10. "maxLength": 30
  11. },
  12. p3 : {
  13. "validation" : false,
  14. "name" : 'string',
  15. "type" : "template"
  16. }
  17. }
  18.  
  19.  
  20. var obj = {
  21. p1 : {
  22. "id" : '32324',
  23. "name" : 'page1',
  24.  
  25. },
  26. p2 : {
  27. "name" : 'page2',
  28. "type": "template"
  29. },
  30. p3 : {
  31. "name" : 'page3',
  32. "type": "template2"
  33. }
  34. }
  35.  
  36. for (var property in valRule){
  37. if(valRule[property].validation === true){
  38. console.log(valRule[property]);
  39. for (var [key, value] of Object.entries(valRule[property])){
  40. if(!valRule[property].name[property] === 'string'){
  41. console.log(value)
  42. }
  43. }
  44. }
  45. }
Add Comment
Please, Sign In to add comment