How to use the typescript-monads.maybe function in typescript-monads

To help you get started, we’ve selected a few typescript-monads 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 patrickmichalina / fusing-angular / fuse.ts View on Github external
setServerRef(val?: ServerLauncher) {
    this.serverRef = maybe(val)
  }
  killNgc = () => this.ngcProcess.tapSome(ref => ref.kill())
github patrickmichalina / fusing-angular / src / server / config.ts View on Github external
    .match({ some: maybe, none: () => maybe(process.env.PORT) })
    .map(p => +p).valueOr(4200),
github patrickmichalina / fusing-angular / src / electron / menus / shared / language.ts View on Github external
.tapSome(items => {
      items.forEach(i => i.checked = false)
      maybe(items.find(b => b.id === lang)).tapSome(b => {
        sendAngularMessage(window, 'change-language', lang)
        b.checked = true
      })
    })
}
github patrickmichalina / fusing-angular / src / server / config.ts View on Github external
readonly [key: string]: string
}

export interface IConfig {
  readonly PORT: number
  readonly NODE_DEBUG: boolean
  readonly CLUSTERED_WORKERS: number
  readonly DIST_FOLDER: string
  readonly WWW_ROOT: string
  readonly HTTP_LOGS_ENABLED: boolean
}

export const STANDARD_CONFIG: IConfig = {
  NODE_DEBUG: maybe(process.env.NODE_ENV).filter(a => a === 'production').isNone(),
  HTTP_LOGS_ENABLED: maybe(process.env.HTTP_LOGS_DISABLED).filter(Boolean).isNone(),
  PORT: maybe(argv['port'] as string | undefined)
    .match({ some: maybe, none: () => maybe(process.env.PORT) })
    .map(p => +p).valueOr(4200),
  CLUSTERED_WORKERS: maybe(process.env.WEB_CONCURRENCY).map(a => +a).valueOr(1),
  DIST_FOLDER: resolve('dist'),
  WWW_ROOT: 'wwwroot'
}
github patrickmichalina / fusing-angular / fuse.ts View on Github external
electron: {
      renderer: fusebox({
        target: 'browser',
        output: 'dist/desktop/wwwroot/assets/js',
        entry: this.aot
          ? this.prod ? 'ngc/esnext/electron/angular/main.aot.prod.js' : 'ngc/esnext/electron/angular/main.aot.js'
          : this.prod ? 'src/electron/angular/main.prod.ts' : 'src/electron/angular/main.ts',
        webIndex: { template: 'src/browser/index.pug', distFileName: '../../index.html', publicPath: '/assets/js' },
        dependencies: { ignorePackages: packageJson.fusebox.ignore.browser },
        codeSplitting: { useHash: false, maxPathLength: 0 },
        devServer: false,
        env: Object
          .keys(process.env)
          .filter(k => k.includes('NG_'))
          .reduce((acc, curr) => ({ ...acc, [curr.replace('NG_', '')]: process.env[curr] }), {
            NG_SERVER_HOST: maybe(process.env.HOSTNAME).valueOr(`http://localhost:${this.ngServerPort}`)
          }),
        ...this.shared,
        plugins: [pluginConsolidate('pug', { ...pugSharedLocals, isElectron: true }), ...this.shared.plugins]
      }),
      main: fusebox({
        target: 'electron',
        entry: 'src/electron/app.ts',
        output: 'dist/desktop',
        useSingleBundle: true,
        devServer: false,
        sourceMap: false,
        dependencies: {
          ignoreAllExternal: false,
          ignorePackages: packageJson.fusebox.ignore.electron
        },
        ...this.shared
github patrickmichalina / fusing-angular / src / server / config.ts View on Github external
export interface StringDictionary {
  readonly [key: string]: string
}

export interface IConfig {
  readonly PORT: number
  readonly NODE_DEBUG: boolean
  readonly CLUSTERED_WORKERS: number
  readonly DIST_FOLDER: string
  readonly WWW_ROOT: string
  readonly HTTP_LOGS_ENABLED: boolean
}

export const STANDARD_CONFIG: IConfig = {
  NODE_DEBUG: maybe(process.env.NODE_ENV).filter(a => a === 'production').isNone(),
  HTTP_LOGS_ENABLED: maybe(process.env.HTTP_LOGS_DISABLED).filter(Boolean).isNone(),
  PORT: maybe(argv['port'] as string | undefined)
    .match({ some: maybe, none: () => maybe(process.env.PORT) })
    .map(p => +p).valueOr(4200),
  CLUSTERED_WORKERS: maybe(process.env.WEB_CONCURRENCY).map(a => +a).valueOr(1),
  DIST_FOLDER: resolve('dist'),
  WWW_ROOT: 'wwwroot'
}
github patrickmichalina / fusing-angular / src / server / config.ts View on Github external
export interface StringDictionary {
  readonly [key: string]: string
}

export interface IConfig {
  readonly PORT: number
  readonly NODE_DEBUG: boolean
  readonly CLUSTERED_WORKERS: number
  readonly DIST_FOLDER: string
  readonly WWW_ROOT: string
  readonly HTTP_LOGS_ENABLED: boolean
}

export const STANDARD_CONFIG: IConfig = {
  NODE_DEBUG: maybe(process.env.NODE_ENV).filter(a => a === 'production').isNone(),
  HTTP_LOGS_ENABLED: maybe(process.env.HTTP_LOGS_DISABLED).filter(Boolean).isNone(),
  PORT: maybe(argv['port'] as string | undefined)
    .match({ some: maybe, none: () => maybe(process.env.PORT) })
    .map(p => +p).valueOr(4200),
  CLUSTERED_WORKERS: maybe(process.env.WEB_CONCURRENCY).map(a => +a).valueOr(1),
  DIST_FOLDER: resolve('dist'),
  WWW_ROOT: 'wwwroot'
}

typescript-monads

Write cleaner TypeScript

MIT
Latest version published 4 months ago

Package Health Score

65 / 100
Full package analysis

Popular typescript-monads functions