assert-options

  • Version 0.8.1
  • Published
  • 10.1 kB
  • No dependencies
  • MIT license

Install

npm i assert-options
yarn add assert-options
pnpm add assert-options

Overview

Generic options parameter handling.

Index

Variables

variable assertOptions

const assertOptions: AssertFunc;
  • Default options-assert function.

Functions

function createAssert

createAssert: (errHandler: IOptionsErrorHandler) => AssertFunc;
  • Creates an options-assert function that uses specified error handler.

Classes

class DefaultErrorHandler

class DefaultErrorHandler implements IOptionsErrorHandler {}
  • Default handler for options-related issues.

method handle

handle: (err: OptionsError, ctx: IOptionsErrorContext) => NamedValues;

    Interfaces

    interface IOptionsErrorContext

    interface IOptionsErrorContext {}
    • Error-related context available for options-related issues.

    property defaults

    defaults: any;

      property key

      key?: string;

        property options

        options: any;

          interface IOptionsErrorHandler

          interface IOptionsErrorHandler {}

            method handle

            handle: (err: OptionsError, ctx: IOptionsErrorContext) => NamedValues;
            • This method is normally expected to throw an error, based on "err"

            Enums

            enum OptionsError

            enum OptionsError {
            invalidOptionsParam = 0,
            invalidDefaultsParam = 1,
            optionNotRecognized = 2,
            }
            • All errors that can occur inside an assert function.

            member invalidDefaultsParam

            invalidDefaultsParam = 1

              member invalidOptionsParam

              invalidOptionsParam = 0

                member optionNotRecognized

                optionNotRecognized = 2

                  Type Aliases

                  type AssertFunc

                  type AssertFunc = (
                  options: NamedValues | null | undefined,
                  defaults: NamedValues | string[]
                  ) => NamedValues;
                  • Assert function signature.

                  type NamedValues

                  type NamedValues = {
                  [name: string]: any;
                  };
                  • Standard syntax for named values.

                  Package Files (4)

                  Dependencies (0)

                  No dependencies.

                  Dev Dependencies (10)

                  Peer Dependencies (0)

                  No peer dependencies.

                  Badge

                  To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                  You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/assert-options.

                  • Markdown
                    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/assert-options)
                  • HTML
                    <a href="https://www.jsdocs.io/package/assert-options"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>