Home Intro Source Mebo GitHub
import Version from 'mebo/src/Inputs/Version.js'
public class | source

Version

Extends:

InputBaseText → Version

Version input.

This input follows the semver convention.

const input = Input.create('myInput: version');
input.setValue('2.2.1');

Property Summary

Property Name Description Defined by Default Default Value
minimumRequired minimum version required

All properties including the inherited ones can be listed via registeredPropertyNames

See:

Method Summary

Protected Methods
protected

Implements input's validations

Inherited Summary

From class Input
public static

create(inputInterface: string, properties: Object, extendedValidation: function): Input

Creates an input instance.

public static

register(inputClass: Input, name: string)

Registers a new input type to the available inputs

public static

registerProperty(inputClassOrRegisteredName: string | Input, name: string, initialValue: *)

Registers a property for the input type (also available as Mebo.Input.registerProperty)

public static

Returns the input type based on the registration name

public static

Returns a list containing the names of the registered input types

public static

registeredPropertyNames(inputClassOrRegisteredName: string | Input): Array<string>

Returns a list about all registered property names including the inherited ones for the input type

protected static

_decodeScalar(value: string): *

Decodes the input value from the string representation (Input._encodeScalar) to the data type of the input.

protected static

_decodeVector(value: string): *

Decodes a vector value from the string representation ({Input._encodeScalar & Input._encodeVector) to the data type of the input.

protected static

_encodeScalar(value: *): string

Encodes the input value to a string representation that can be later decoded through Input._decode.

protected static

Encodes a vector value to a string representation that can be later decoded through Input._decodeVector.

public

assignProperty(name: string, value: *, loose: boolean)

Sets a property to the input.

public

Returns the cache used by the input

public

Forces to flush the internal input cache

public

Returns a boolean telling if the input property name is assigned to the input

public

Returns if the value of the input is empty.

public

Returns a boolean telling if the property is locked (Input.lockProperty)

public

Returns if the value of the input is required.

public

Returns if the input is serializable

public

Returns if the value of the input is a vector.

public

lockProperty(name: string, lock: boolean)

Prevents a property value to be modified by Input.assignProperty

public

Returns the name of the input which is defined at construction time (inputs cannot be renamed)

public

parseValue(value: string, assignValue: boolean): *

Decodes a value represented as string to the type that is compatible with the input.

public

property(name: string): Promise<*>

Returns the property value for the input property name

public

Returns a list containing the property names assigned to the input

public

Returns a boolean telling if the input is in read-only mode.

public

This method should return a string representation about the current value in a way that can be recovered later through parseValue.

public

setReadOnly(enable: boolean)

Changes the read-only state of the input.

public

setValue(value: *)

Sets the value of the input

public

setupFrom(sourceInput: Input, at: null | number, cache: boolean)

Sets the input value by avoiding the overhead that may occur when the same value is used across actions that have the input type, therefore this method avoids the re-computation by copying the caches and value associated with the source input to the current input.

public

async validate(): Promise<*>

Executes the input validations (_validation), in case of a failed validation then an exception of type ValidationFail is raised

public

value(): *

Returns the value of the input

public

valueAt(index: number): *

This method enforces the context of the value being queried.

protected

_getFromCache(name: string, at: null | number): *

Auxiliary method used internally by the input implementations to get a value from the cache

protected

Auxiliary method used internally by input implementations to check if the key is under the cache

protected

_setToCache(name: string, value: *, at: null | number)

Auxiliary method used internally by input implementations to set a value to the cache

protected

async _validation(at: null | number): Promise<*>

Use this method to implement generic validations for your input implementation.

From class BaseText
protected static

_decodeVector(value: string): *

Decodes a vector value from the string representation (Input._encodeVector) to the data type of the input.

protected static

Encodes a vector value to a string representation that can be later decoded through Input._decodeVector.

public

Returns if the input is empty

protected

Implements input's validations

Protected Methods

protected _validation(at: null | number): Promise<*> source

Implements input's validations

Override:

BaseText#_validation

Params:

NameTypeAttributeDescription
at null | number

index used when input has been created as a vector that tells which value should be used

Return:

Promise<*>

value held by the input based on the current context (at)