Skip to content

stripV

Strip the leading “v” from a version string if it exists.

Available since v1.9.0

import { stripV } from '@helpers4/version';
stripV(version: string): string
ParameterTypeDescription
versionstringThe version string to process

string — The version string without leading “v”, or the original value if it’s not a string or doesn’t start with “v”

Strips the leading “v” from a git tag-style version string.

stripV('v1.2.3')
// => '1.2.3'

Returns the string unchanged when it does not start with “v”.

stripV('1.2.3')
// => '1.2.3'

View source on GitHub