How to use the mobiledoc-kit/utils/array-utils.any function in mobiledoc-kit

To help you get started, we’ve selected a few mobiledoc-kit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gazooka / GhostInAzureWebApp / node_modules / @tryghost / mobiledoc-kit / src / js / parsers / section.js View on Github external
// close a trailing text node if it exists
    if (state.text.length && state.section.isMarkerable) {
      this._createMarker();
    }

    // push listItems onto the listSection or add a new section
    if (state.section.isListItem && lastSection && lastSection.isListSection) {
      trimSectionText(state.section);
      lastSection.items.append(state.section);
    } else {
      // avoid creating empty markup sections, especially useful for indented source
      if (
        state.section.isMarkerable &&
        !state.section.text.trim() &&
        !any(state.section.markers, marker => marker.isAtom)
      ) {
        state.section = null;
        state.text = '';
        return;
      }

      // remove empty list sections before creating a new section
      if (lastSection && lastSection.isListSection && lastSection.items.length === 0) {
        sections.pop();
      }

      sections.push(state.section);
    }

    state.section = null;
    state.text = '';
github bustle / mobiledoc-kit / src / js / parsers / section.js View on Github external
// close a trailing text node if it exists
    if (state.text.length && state.section.isMarkerable) {
      this._createMarker();
    }

    // push listItems onto the listSection or add a new section
    if (state.section.isListItem && lastSection && lastSection.isListSection) {
      trimSectionText(state.section);
      lastSection.items.append(state.section);
    } else {
      // avoid creating empty markup sections, especially useful for indented source
      if (
        state.section.isMarkerable &&
        !state.section.text.trim() &&
        !any(state.section.markers, marker => marker.isAtom)
      ) {
        state.section = null;
        state.text = '';
        return;
      }

      // remove empty list sections before creating a new section
      if (lastSection && lastSection.isListSection && lastSection.items.length === 0) {
        sections.pop();
      }

      sections.push(state.section);
    }

    state.section = null;
    state.text = '';