当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Arr.find方法代码示例

本文整理汇总了TypeScript中@ephox/katamari.Arr.find方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Arr.find方法的具体用法?TypeScript Arr.find怎么用?TypeScript Arr.find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@ephox/katamari.Arr的用法示例。


在下文中一共展示了Arr.find方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

const getItemSelection = (editor: Editor): Option<ItemSelection> => {
  const selectedListItems = Arr.map(Selection.getSelectedListItems(editor), Element.fromDom);

  return Options.liftN([
    Arr.find(selectedListItems, Fun.not(hasFirstChildList)),
    Arr.find(Arr.reverse(selectedListItems), Fun.not(hasFirstChildList))
  ], (start, end) => ({ start, end }));
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:8,代码来源:ListsIndendation.ts

示例2:

const lookup = (compInSystem: AlloyComponent, footerButtons: DialogMemButton[], buttonName: string) => {
  return Arr.find(footerButtons, (button) => {
    return button.name === buttonName;
  }).bind((memButton) => {
    return memButton.memento.getOpt(compInSystem);
  });
};
开发者ID:tinymce,项目名称:tinymce,代码行数:7,代码来源:SilverDialogFooter.ts

示例3: function

 Chain.async(function (container, next, die) {
   return Arr.find(editor.windowManager.getWindows(), function (win) {
     return container.dom().id === win._id;
   }).fold(() => die('Could not find popup window'), function (win) {
     next(win);
   });
 })
开发者ID:danielpunkass,项目名称:tinymce,代码行数:7,代码来源:UploadTabTest.ts

示例4: function

 Chain.on(function (container, next, die) {
   return Arr.find(editor.windowManager.getWindows(), function (win) {
     return container.dom().id === win._id;
   }).fold(die, function (win) {
     next(Chain.wrap(win));
   });
 })
开发者ID:abstask,项目名称:tinymce,代码行数:7,代码来源:UploadTabTest.ts

示例5:

 const scanAndSet = (dialogApi: Types.Dialog.DialogInstanceApi<typeof initialData>, pattern: string) => {
   Arr.find(charMap, (group) => group.name === currentTab.get()).each((f) => {
     const items = Scan.scan(f, pattern);
     dialogApi.setData({
       results: items
     });
   });
 };
开发者ID:tinymce,项目名称:tinymce,代码行数:8,代码来源:Dialog.ts

示例6: handler

 AlloyEvents.run<SystemEvents.AlloySlotVisibilityEvent>(SystemEvents.slotVisibility(), (sidepanel, se) => {
   const data = se.event();
   const optSidePanelSpec = Arr.find(specs, (config) => config.name === data.name());
   optSidePanelSpec.each((sidePanelSpec) => {
     const handler = data.visible() ? sidePanelSpec.onShow : sidePanelSpec.onHide;
     handler(sidePanelSpec.getApi(sidepanel));
   });
 })
开发者ID:tinymce,项目名称:tinymce,代码行数:8,代码来源:Sidebar.ts

示例7: function

const maybeUrlize = function (editor, key) {
  return Arr.find(PluginUrls.urls, function (x) {
    return x.key === key;
  }).fold(function () {
    const getMetadata = editor.plugins[key].getMetadata;
    return typeof getMetadata === 'function' ? makeLink(getMetadata()) : key;
  }, function (x) {
    return makeLink({ name: x.name, url: 'https://www.tinymce.com/docs/plugins/' + x.key });
  });
};
开发者ID:abstask,项目名称:tinymce,代码行数:10,代码来源:PluginsTab.ts

示例8: function

const getServiceErrorMsg = function (type) {
  return Arr.find(friendlyServiceErrors, function (error) {
    return error.type === type;
  }).fold(
    Fun.constant('Unknown service error'),
    function (error) {
      return error.message;
    }
  );
};
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:10,代码来源:Errors.ts

示例9: function

    return Step.sync(function () {
      state.set([]);

      const matches = MatchKeys.match(patterns, event);
      Assertions.assertEq('Should have some matches', true, matches.length > 0);

      Arr.find(matches, function (pattern) {
        return pattern.action();
      });

      Assertions.assertEq('Should have the expected state', expectedData, state.get());
    });
开发者ID:abstask,项目名称:tinymce,代码行数:12,代码来源:MatchKeysTest.ts


注:本文中的@ephox/katamari.Arr.find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。