# base/version (vanilla.js 0.4.0)

> https://vanillapunch.com/docs/vanilla.js/0.4.0/api/base/version/

Version class.

## Version extends Object

Version class.

Example: Make a version string

```js
import { Version } from "./build/vanilla.js";

const version = Version.create(0, 4, 0, "dev");
console.log(version.getVersionString());

version.setBranch("");
version.setPatch(1);
console.log(version.getVersionString(), version.getMajor(), version.getMinor());
```

- `constructor()` (constructor, since 0.0.8): Constructor.
- `setMajor(major)` (method, since 0.0.8): Sets the major version.
  - `major` number: Major number.
- `getMajor()` (method, since 0.0.8): Returns the major version.
  - returns number: Major number.
- `setMinor(minor)` (method, since 0.0.8): Sets the minor version.
  - `minor` number: Minor number.
- `getMinor()` (method, since 0.0.8): Returns the minor version.
  - returns number: Minor number.
- `setPatch(patch)` (method, since 0.0.8): Sets the patch version.
  - `patch` number: Patch number.
- `getPatch()` (method, since 0.0.8): Returns the patch version.
  - returns number: Patch number.
- `setBranch(branch)` (method, since 0.0.8): Sets the branch.
  - `branch` string: Branch name. (not added to the version string if empty)
- `getBranch()` (method, since 0.0.8): Returns the branch.
  - returns string: Branch name. (empty string if none)
- `getVersionString()` (method, since 0.0.8): Returns the version string.
  - returns number: A string shaped "major.minor.patch". (adds "-branch" if there is a branch)
- `static create(major, minor, patch, branch = "")` (static, since 0.0.8): Constructor.
  - `major` number: Major number.
  - `minor` number: Minor number.
  - `patch` number: Patch number.
  - `branch` string: Branch name. (default empty string)
  - returns Version: The created version.
