@avanio/variable-util
    Preparing search index...

    Function getConfigObjectResult

    • Wrapper around getConfigObject that returns a Result

      Type Parameters

      • Output

      Parameters

      Returns Promise<IResult<{ type: undefined | string; value: Output }>>

      result

      // from "@avanio/variable-util-node"
      const fileEnv = new FileConfigLoader({fileName: './settings.json', type: 'json'}).getLoader;
      const portConfig: Result<{type: string | undefined; value: string}> = await getConfigObject('PORT', [env(), fileEnv()], stringParser, '8080', {showValue: true});
      if ( portConfig.isOk() ) {
      const {value, type} = portConfig.unwrap();
      } else {
      // handle error
      }

      v0.2.5

    • Wrapper around getConfigObject that returns a Result

      Type Parameters

      • Output

      Parameters

      Returns Promise<IResult<{ type: undefined | string; value: undefined | Output }>>

      result

      // from "@avanio/variable-util-node"
      const fileEnv = new FileConfigLoader({fileName: './settings.json', type: 'json'}).getLoader;
      const portConfig: Result<{type: string | undefined; value: string}> = await getConfigObject('PORT', [env(), fileEnv()], stringParser, '8080', {showValue: true});
      if ( portConfig.isOk() ) {
      const {value, type} = portConfig.unwrap();
      } else {
      // handle error
      }

      v0.2.5