Example #1
0
const isUniqueUrl = function (url, targets) {
  const foundTarget = Arr.exists(targets, function (target) {
    return target.url === url;
  });

  return !foundTarget;
};
Example #2
0
 getItems: () => Arr.bind(menu.items, (i) => {
   const itemName = i.toLowerCase();
   if (itemName.trim().length === 0) {
     return [ ];
   } else if (Arr.exists(removedMenuItems, (removedMenuItem) => removedMenuItem === itemName)) {
     return [ ];
   } else if (itemName === 'separator' || itemName === '|') {
     return [{
       type: 'separator'
     }];
   } else if (registry.menuItems[itemName]) {
     return [ registry.menuItems[itemName] ];
   } else {
     return [ ];
   }
 })
Example #3
0
const hasBlockParent = function (blockElements, root, node) {
  return Arr.exists(Parents.parents(Element.fromDom(node), Element.fromDom(root)), function (elm) {
    return isBlockElement(blockElements, elm.dom());
  });
};
Example #4
0
const menuHasIcons = (xs: SingleMenuItemApi[]) => Arr.exists(xs, hasIcon);
Example #5
0
 function valueExists(values) {
   return Arr.exists(values, (a) => {
     return a.menu ? valueExists(a.menu) : a.value === value;
   });
 }
Example #6
0
 return Arr.filter(menus, (menu) => {
   // Filter out menus that have no items, or only separators
   const isNotSeparator = (item) => item.type !== 'separator';
   return menu.getItems().length > 0 && Arr.exists(menu.getItems(), isNotSeparator);
 });
Example #7
0
const emojiMatches = (emoji: EmojiEntry, lowerCasePattern: string): boolean => {
  return Strings.contains(emoji.title.toLowerCase(), lowerCasePattern) || Arr.exists(emoji.keywords, (k) => Strings.contains(k.toLowerCase(), lowerCasePattern));
};