Guest User

Untitled

a guest
Jun 22nd, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. checkAvailableConfirmTypes() {
  2. // variables
  3. let oldTypes = [
  4. {id: "2",text: "operator's call", show: true},
  5. {id: "4",text: "confirm by sms", show: true}
  6. ];
  7. let newTypes = {
  8. 0: "2",
  9. };
  10. //add a new Set from newTypes
  11. let tempSet = new Set();
  12. for(let item in newTypes) {
  13. tempSet.add(newTypes[item]);
  14. }
  15. //if oldTypes item hasn't got tempSet item.id -> show = false
  16. oldTypes.forEach((item)=> {
  17. !tempSet.has(item.id) ? item.show = false : item.show = true;
  18. });
  19. }
Add Comment
Please, Sign In to add comment