H5P NodeJS Library
    Preparing search index...

    Represents the information needed to identify an installed library. This information is also called ubername when it's represented as a string like this: H5P.Example-1.0 Even though H5P libraries generally also have a patch version (1.0.0), the patch version is not needed to identify an installed library as there can only be one installed patch version of a library at a time. (However, It is possible to install the same library in different major or minor versions. That's why the machine name is not enough to identify it.)

    Implements

    Index

    Constructors

    • Constructs the object and validates the parameters.

      Parameters

      • machineName: string
      • majorVersion: number
      • minorVersion: number

      Returns LibraryName

      errors if the validation fails

    Properties

    machineName: string

    The name used to identify the library (e.g. H5P.Example)

    majorVersion: number

    The major version of the library (e.g. 1)

    minorVersion: number

    The minor version of the library (e.g. 0)

    Methods

    • Parses the ubername (e.g. "H5P.Example-1.0") and returns a library name object.

      Parameters

      • ubername: string

        The library name in a format "H5P.Example-1.0" or "H5P.Example 1.0" (see options)

      • options: { useHyphen?: boolean; useWhitespace?: boolean } = ...
        • OptionaluseHyphen?: boolean

          true if the parser should accept names like "H5P.Library-1.0"

        • OptionaluseWhitespace?: boolean

          true if the parser should accept names like "H5P.Library 1.0"

      Returns ILibraryName

      undefined if the name could not be parsed

      H5pError with 400 when the ubername is invalid

    • Returns the ubername for a library (e.g. H5P.ExampleLibrary-1.0). Also validates the ubername to protect against attempts to manipulate the server by creating invalid ubernames.

      Parameters

      • libraryName: ILibraryName
      • options: { useHyphen?: boolean; useWhitespace?: boolean } = ...

      Returns string

    • Throws an error if the machine name is not valid.

      Parameters

      • machineName: string

      Returns void