UNPKG

@nevis-security/nevis-mobile-authentication-sdk-react

Version:

React Native plugin for Nevis Mobile Authentication SDK. Supports only mobile.

71 lines (64 loc) 1.97 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.VersionImpl = exports.Version = void 0; /** * Copyright © 2024 Nevis Security AG. All rights reserved. */ /** * Represents a generic version with major, minor, patch and buildNumber fields. */ class Version { /** * The major field of the version, such as 1 in version 1.5.3.4. */ /** * The minor field of the version, such as 5 in version 1.5.3.4. */ /** * The patch field of the version, such as 3 in version 1.5.3.4. */ /** * The build number field of the version, such as 4 in version 1.5.3.4. */ /** * Default constructor for {@link Version}. * * @param major major field of the version. * @param minor minor field of the version. * @param patch patch field of the version. * @param buildNumber build number field of the version. * @returns a {@link Version} instance. */ static create(major, minor, patch, buildNumber) { return new VersionImpl(major, minor, patch, buildNumber); } /** * Alternate constructor that creates a {@link Version} from a json. * * @param json contains the source for instance creation. * @returns a {@link Version} instance. */ static fromJson(json) { return VersionImpl.fromJson(json); } } exports.Version = Version; class VersionImpl extends Version { constructor(major, minor, patch, buildNumber) { super(); this.major = major; this.minor = minor; this.patch = patch; this.buildNumber = buildNumber; } static fromJson(json) { if (json.major === undefined || json.minor === undefined || json.patch === undefined || json.buildNumber === undefined) { throw new Error('Unknown Version; Some parts of the version is not present in json: ', json); } return new VersionImpl(json.major, json.minor, json.patch, json.buildNumber); } } exports.VersionImpl = VersionImpl; //# sourceMappingURL=Version.js.map