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


TypeScript Type.isArray方法代码示例

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


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

示例1: function

const normalizePlugins = function (plugins) {
  const pluginNames = Type.isArray(plugins) ? plugins.join(' ') : plugins;
  const trimmedPlugins = Arr.map(Type.isString(pluginNames) ? pluginNames.split(' ') : [ ], Strings.trim);
  return Arr.filter(trimmedPlugins, function (item) {
    return item.length > 0;
  });
};
开发者ID:nyroDev,项目名称:tinymce,代码行数:7,代码来源:EditorSettings.ts

示例2:

const isToolbarEnabled = (editor: Editor) => {
  const toolbarConfig = editor.getParam('toolbar');
  if (Type.isArray(toolbarConfig)) {
    return toolbarConfig.length > 0;
  } else {
    return editor.getParam('toolbar', true, 'boolean') !== false;
  }
};
开发者ID:tinymce,项目名称:tinymce,代码行数:8,代码来源:Settings.ts

示例3: if

const getToolbar = (editor: Editor): string[] => {
  const toolbar = editor.getParam('table_toolbar', defaultTableToolbar);

  if (toolbar === '' || toolbar === false) {
    return [];
  } else if (Type.isString(toolbar)) {
    return toolbar.split(/[ ,]/);
  } else if (Type.isArray(toolbar)) {
    return toolbar;
  } else {
    return [];
  }
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:13,代码来源:Settings.ts

示例4: if

const createToolbar = (toolbarConfig: Partial<RenderUiConfig>): ToolbarGroupSetting[] => {
  if (toolbarConfig.toolbar === false) {
    return [];
  } else if (toolbarConfig.toolbar === undefined || toolbarConfig.toolbar === true) {
    return removeUnusedDefaults(toolbarConfig.buttons);
  } else if (Type.isString(toolbarConfig.toolbar)) {
    return convertStringToolbar(toolbarConfig.toolbar);
  } else if (Type.isArray(toolbarConfig.toolbar) && Type.isString(toolbarConfig.toolbar[0])) {
    return convertStringToolbar(toolbarConfig.toolbar.join(' | '));
  } else {
    return toolbarConfig.toolbar;
  }
};
开发者ID:tinymce,项目名称:tinymce,代码行数:13,代码来源:Integration.ts

示例5: createPatternSet

const getPatternSet = (editorSettings): PatternSet => {
  const patterns = Obj.get(editorSettings, 'textpattern_patterns').getOr(defaultPatterns);
  if (!Type.isArray(patterns)) {
    error('The setting textpattern_patterns should be an array');
    return {
      inlinePatterns: [],
      blockPatterns: [],
    };
  }
  const normalized = Results.partition(Arr.map(patterns, normalizePattern));
  Arr.each(normalized.errors, (err) => error(err.message, err.pattern));
  return createPatternSet(normalized.values);
};
开发者ID:tinymce,项目名称:tinymce,代码行数:13,代码来源:Settings.ts

示例6: if

const getContentCss = (editor: Editor): string[] => {
  const contentCss = editor.settings.content_css;

  if (Type.isString(contentCss)) {
    return Arr.map(contentCss.split(','), Strings.trim);
  } else if (Type.isArray(contentCss)) {
    return contentCss;
  } else if (contentCss === false || editor.inline) {
    return [];
  } else {
    return ['default'];
  }
};
开发者ID:tinymce,项目名称:tinymce,代码行数:13,代码来源:Settings.ts

示例7: Error

const items = (value: boolean | string, defaultValue: string): string => {

  if (Type.isArray(value) || Type.isObject(value)) {
    throw new Error('expected a string but found: ' + value);
  }

  if (Type.isUndefined(value)) {
    return defaultValue;
  }

  if (Type.isBoolean(value)) {
    return value === false ? '' : defaultValue;
  }
  return value;
};
开发者ID:tinymce,项目名称:tinymce,代码行数:15,代码来源:EditorSettings.ts

示例8: function

  const register = function (name: string | Formats, format?: Format | Format[]) {
    if (name) {
      if (typeof name !== 'string') {
        Tools.each(name, function (format, name) {
          register(name, format);
        });
      } else {
        // Force format into array and add it to internal collection
        if (!Type.isArray(format)) {
          format = [format];
        }

        Tools.each(format, function (format: any) {
          // Set deep to false by default on selector formats this to avoid removing
          // alignment on images inside paragraphs when alignment is changed on paragraphs
          if (typeof format.deep === 'undefined') {
            format.deep = !format.selector;
          }

          // Default to true
          if (typeof format.split === 'undefined') {
            format.split = !format.selector || format.inline;
          }

          // Default to true
          if (typeof format.remove === 'undefined' && format.selector && !format.inline) {
            format.remove = 'none';
          }

          // Mark format as a mixed format inline + block level
          if (format.selector && format.inline) {
            format.mixed = true;
            format.block_expand = true;
          }

          // Split classes if needed
          if (typeof format.classes === 'string') {
            format.classes = format.classes.split(/\s+/);
          }
        });

        formats[name] = format;
      }
    }
  };
开发者ID:tinymce,项目名称:tinymce,代码行数:45,代码来源:FormatRegistry.ts

示例9: err

 const formatOrCmd = <T> (name: string, onFormat: (formats: string[]) => T, onCommand: (cmd: string, value: any) => T): Result<T, PatternError> => {
   if (pattern.format !== undefined) {
     let formats: string[];
     if (Type.isArray(pattern.format)) {
       if (!Arr.forall(pattern.format, Type.isString)) {
         return err(name + ' pattern has non-string items in the `format` array');
       }
       formats = pattern.format;
     } else if (Type.isString(pattern.format)) {
       formats = [pattern.format];
     } else {
       return err(name + ' pattern has non-string `format` parameter');
     }
     return Result.value(onFormat(formats));
   } else if (pattern.cmd !== undefined) {
     if (!Type.isString(pattern.cmd)) {
       return err(name + ' pattern has non-string `cmd` parameter');
     }
     return Result.value(onCommand(pattern.cmd, pattern.value));
   } else {
     return err(name + ' pattern is missing both `format` and `cmd` parameters');
   }
 };
开发者ID:tinymce,项目名称:tinymce,代码行数:23,代码来源:Pattern.ts

示例10:

const isTokenised = (str: any): str is TokenisedString => Type.isArray(str) && str.length > 1;
开发者ID:tinymce,项目名称:tinymce,代码行数:1,代码来源:I18n.ts


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