How to use the decoders.either3 function in decoders

To help you get started, we’ve selected a few decoders 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 facebookarchive / atom-ide-ui / modules / atom-ide-ui / pkg / atom-ide-terminal / lib / createTerminal.js View on Github external
declare class TerminalClass extends XTerminal {
  proposeGeometry: () => {rows: number, cols: number};
  fit: () => void;
  webLinksInit: (handler?: (event: Event, link: string) => void) => void;

  // TODO: Update xterm types?
  linkifier: any;
  buffer: any;
  selectionManager: any;
  dispose: () => void;
}

const assertTerminalOptionsInFeatureConfig = guard(
  object({
    cursorBlink: boolean,
    cursorStyle: either3(
      constant('block'),
      constant('underline'),
      constant('bar'),
    ),
    scrollback: number,
    fontFamily: string,
    fontSize: number,
    lineHeight: number,
    macOptionIsMeta: boolean,
    allowTransparency: boolean,
    experimentalCharAtlas: either3(
      constant('none'),
      constant('static'),
      constant('dynamic'),
    ),
    rendererType: either(constant('canvas'), constant('dom')),
github facebookarchive / atom-ide-ui / modules / atom-ide-ui / pkg / atom-ide-terminal / lib / createTerminal.js View on Github external
const assertTerminalOptionsInFeatureConfig = guard(
  object({
    cursorBlink: boolean,
    cursorStyle: either3(
      constant('block'),
      constant('underline'),
      constant('bar'),
    ),
    scrollback: number,
    fontFamily: string,
    fontSize: number,
    lineHeight: number,
    macOptionIsMeta: boolean,
    allowTransparency: boolean,
    experimentalCharAtlas: either3(
      constant('none'),
      constant('static'),
      constant('dynamic'),
    ),
    rendererType: either(constant('canvas'), constant('dom')),
  }),
);

export function createTerminal(options: TerminalOptions = {}): Terminal {
  // Load the addons on-demand the first time we create a terminal.
  // $FlowIgnore
  if (XTerminal.fit == null) {
    // The 'fit' add-on resizes the terminal based on the container size
    // and the font size such that the terminal fills the container.
    XTerminal.applyAddon(Fit);
  }
github nvie / decoders / src / types / typescript-tests.ts View on Github external
case 'rect':
            return rect;
        case 'circle':
            return circle;
    }
    return fail('Must be a valid shape');
});

guard(
    object({
        a0: string,
        a1: number,
        a2: optional(nullable(either4(string, email, regex(/x/, 'Must be x'), url()))),
        a3: fail('foo'),
        a4: maybe(mixed),
        a5: either3(constant('foo'), constant('bar'), constant('qux')),
        a6: exact({ c: array(poja), d: pojo }),
        a7: tuple6(hardcoded('foo'), mixed, null_, undefined_, unknown, truthy),
        a8: tuple4(integer, number, positiveInteger, positiveNumber),
        a9: either(boolean, numericBoolean),
        b0: map(
            compose(
                string,
                predicate(s => s.startsWith('x'), 'Must start with x')
            ),
            s => s.toUpperCase()
        ),
        b1: shape,
        b2: date,
        b3: dict(string),
        b4: mapping(string),
        b5: oneOf(['foo', 'bar']),