當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Obj.has方法代碼示例

本文整理匯總了TypeScript中@ephox/katamari.Obj.has方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Obj.has方法的具體用法?TypeScript Obj.has怎麽用?TypeScript Obj.has使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@ephox/katamari.Obj的用法示例。


在下文中一共展示了Obj.has方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: cSetFieldValue

 const chains = Arr.flatten(Obj.mapToArray(tabSelectors, (value, key): Chain<any, any>[] => {
   if (Obj.has(data, key)) {
     const newValue = typeof data[key] === 'object' ? data[key].value : data[key];
     return [ cSetFieldValue(tabSelectors[key], newValue) ];
   } else if (Obj.has(data, 'dimensions') && Obj.has(data.dimensions, key)) {
     return [ cSetFieldValue(tabSelectors[key], data.dimensions[key]) ];
   } else {
     return [];
   }
 }));
開發者ID:tinymce,項目名稱:tinymce,代碼行數:10,代碼來源:Helpers.ts

示例2:

 Obj.each(expected.pattern, (value, key) => {
   if (Obj.has<any, string>(pattern, key)) {
     Assertions.assertEq('Pattern ' + (i + 1) + ' property `' + key + '` is not equal', value, pattern[key]);
   } else {
     assert.fail('Pattern ' + (i + 1) + ' property `' + key + '` is missing');
   }
 });
開發者ID:tinymce,項目名稱:tinymce,代碼行數:7,代碼來源:FindInlinePatternTest.ts

示例3: callback

  return Obj.bifilter(currentFormats, (callbacks: FormatChangeCallback[], format: string) => {
    if (!Obj.has(matchedFormats, format)) {
      // Execute callbacks
      Arr.each(callbacks, (callback: FormatChangeCallback) => {
        callback(false, { node: elm, format, parents });
      });

      return false;
    } else {
      return true;
    }
  }).t;
開發者ID:tinymce,項目名稱:tinymce,代碼行數:12,代碼來源:FormatChanged.ts

示例4:

 Arr.each(items, (item, i) => {
   if (isSeparator(item, i)) {
     if (currentSplit.length > 0) {
       allSplits.push(currentSplit);
     }
     currentSplit = [ ];
     if (Obj.has(item.dom, 'innerHtml')) {
       currentSplit.push(item);
     }
   } else {
     currentSplit.push(item);
   }
 });
開發者ID:tinymce,項目名稱:tinymce,代碼行數:13,代碼來源:MenuStructures.ts

示例5: if

  const set = (mode: string) => {
    if (mode === activeMode) {
      return;
    } else if (!Obj.has(availableModes, mode)) {
      throw new Error(`Editor mode '${mode}' is invalid`);
    }

    if (editor.initialized) {
      switchToMode(mode);
    } else {
      editor.on('init', () => switchToMode(mode));
    }
  };
開發者ID:tinymce,項目名稱:tinymce,代碼行數:13,代碼來源:Mode.ts

示例6: addContextMenuGroup

 const items = Arr.foldl(menuConfig, (acc, name) => {
   // Either read and convert the list of items out of the plugin, or assume it's a standard menu item reference
   if (Obj.has(contextMenus, name)) {
     const items = contextMenus[name].update(selectedElement);
     if (Type.isString(items)) {
       return addContextMenuGroup(acc, items.split(' '));
     } else if (items.length > 0) {
       // TODO: Should we add a ValueSchema check here?
       const allItems = Arr.map(items, makeContextItem);
       return addContextMenuGroup(acc, allItems);
     } else {
       return acc;
     }
   } else {
     return acc.concat([name]);
   }
 }, []);
開發者ID:tinymce,項目名稱:tinymce,代碼行數:17,代碼來源:SilverContextMenu.ts

示例7: if

 const realItems = Arr.foldl(items, (acc, item) => {
   if (isMenuItemReference(item)) {
     if (item === '') {
       return acc;
     } else if (item === '|') {
       // Ignore the separator if it's at the start or a duplicate
       return acc.length > 0 && !isSeparator(acc[acc.length - 1]) ? acc.concat([separator]) : acc;
     } else if (Obj.has(menuItems, item.toLowerCase())) {
       return acc.concat([ menuItems[item.toLowerCase()] ]);
     } else {
       // TODO: Add back after TINY-3232 is implemented
       // console.error('No representation for menuItem: ' + item);
       return acc;
     }
   } else {
     return acc.concat([ item ]);
   }
 }, []);
開發者ID:tinymce,項目名稱:tinymce,代碼行數:18,代碼來源:MenuConversion.ts

示例8:

const isNestedFormat = (format: AllowedFormat): format is NestedFormatting => {
  return Obj.has(format as Record<string, any>, 'items');
};
開發者ID:tinymce,項目名稱:tinymce,代碼行數:3,代碼來源:StyleFormat.ts

示例9:

 const updated = Arr.map(shortcut, (segment: string) => {
   // search lowercase, but if not found use the original
   const search = segment.toLowerCase().trim();
   return Obj.has(replace, search) ? replace[search] : segment;
 });
開發者ID:tinymce,項目名稱:tinymce,代碼行數:5,代碼來源:ConvertShortcut.ts

示例10:

const translateCategory = (categories: Record<string, string>, name: string) => {
  return Obj.has(categories, name) ? categories[name] : name;
};
開發者ID:tinymce,項目名稱:tinymce,代碼行數:3,代碼來源:EmojiDatabase.ts


注:本文中的@ephox/katamari.Obj.has方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。