How to use the ferrum.flat function in ferrum

To help you get started, we’ve selected a few ferrum 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 adobe / jsonschema2md / lib / markdownBuilder.js View on Github external
const typefact = (() => {
      if (nulltype) {
        return [inlineCode(`null${isarray}`), text(i18n`, the value must be null`)];
      } else if (singletype && firsttype && typeof firsttype === 'string') {
        return [inlineCode(firsttype + isarray)];
      } else if (!singletype) {
        return [text(isarray ? i18n`an array of the following:` : i18n`any of the folllowing: `), ...flist(flat(realtypes.map((mytype, index) => [inlineCode(mytype || i18n`not defined`), text(index === realtypes.length - 1 ? '' : i18n` or `)])))];
      } else if (merged) {
        return [text(isarray ? 'an array of merged types' : i18n`merged type`)];
      }
      // console.log('unknown type', realtypes, singletype, merged, definition[s.pointer]);
      return [text(i18n`unknown` + isarray)];
    })();
github adobe / helix-cli / src / parcel / AdapterJSAsset.js View on Github external
static isPureScript(basename) {
    // create pairwise combinations of extension and template name
    const exts = into(flat(PURE_EXTENSIONS
      .map((ext) => PURE_TEMPLATES
        .map((template) => `${ext}.${template}`))), Array);
    // use early termination, so that the rest of the statement doesn't
    // have to be evaluated once the first match has been found.
    const matches = exts.reduce((match, ext) => match
      || basename === ext
      || basename.endsWith(`_${ext}`), false);
    return matches;
  }
github adobe / jsonschema2md / lib / markdownBuilder.js View on Github external
const description = definition[s.meta] && definition[s.meta].longdescription ? definition[s.meta].longdescription : paragraph(text(i18n`no description`));

        return [
          heading(level + 1, text(name)),
          description,
          ...makecomment(definition),
          paragraph(inlineCode(name)),
          makefactlist(name, definition, required),
          ...maketypesection(definition, level + 1),
          ...makeconstraintssection(definition, level + 1),
          ...makedefault(definition, level + 1),
          ...makeexamples(definition, level + 1),
          ...makerestrictions(definition, level + 1),
        ];
      }))),
      ...flist(flat(Object.entries(patternProperties || {}).map(([name, definition]) => {
        const description = definition[s.meta].longdescription || paragraph(text(i18n`no description`));

        return [
          heading(level + 1, [text(i18n`Pattern: `), inlineCode(name)]),
          description,
          ...makecomment(definition),
          paragraph(inlineCode(name)),
          makefactlist(name, definition, required),
          ...maketypesection(definition, level + 1),
          ...makeconstraintssection(definition, level + 1),
          ...makedefault(definition, level + 1),
          ...makeexamples(definition, level + 1),
          ...makerestrictions(definition, level + 1),
        ];
      }))),
      ...((definition) => {
github adobe / jsonschema2md / lib / markdownBuilder.js View on Github external
paragraph(text(i18n`Reference this group by using`)),
            code('json', JSON.stringify({ $ref: `${subschema[s.id]}#${subschema[s.pointer]}` })),
            grouptable,
            ...makeproplist(
              subschema[keyword`properties`],
              subschema[keyword`patternProperties`],
              subschema[keyword`additionalProperties`],
              subschema[keyword`required`],
              2,
            ),
          ];
        });

      return [
        heading(1, text(i18n`${gentitle(schema[s.titles], schema[keyword`type`])} Definitions`)),
        ...flist(flat(defgroups)),
      ];
    }
    return [];
  }

ferrum

Features from the rust language in javascript: Provides Traits/Type classes & an advanced library for working with sequences/iterators in js.

Apache-2.0
Latest version published 2 years ago

Package Health Score

62 / 100
Full package analysis