A diminutive API for the Correlation Vector reference implementation. Supports both ESM and CommonJS.
import { cv, increment, extend, spin } from 'correlation-vector';
const vector = cv();
console.log(vector);
// I+2/FsGclq+zYtife68YdA.0
const incremented = increment(vector);
console.log(incremented);
// I+2/FsGclq+zYtife68YdA.1
const extended = extend(incremented);
console.log(extended);
// I+2/FsGclq+zYtife68YdA.1.0
const spun = spin(extended);
console.log(spun);
// I+2/FsGclq+zYtife68YdA.1.0.384636491.0
Vectors can be created via cv()
:
import { cv } from 'correlation-vector';
const vector = cv();
The create()
alias may also be used:
import * as cv from 'correlation-vector';
const vector = cv.create();
-
v2
(default): 22 character base, 127 character max -
v1
: 16 character base, 63 character max
Operations return a new vector.
-
extend(cv)
: Extends the vector -
increment(cv)
: Increments the vector -
spin(cv)
: Spins the vector -
terminate(cv)
: Terminates the vector with a!
Properties return information about a vector.
-
base(cv)
: Gets the vector base (string
) -
extension(cv)
: Gets the vector extension (number
) -
immutable(cv)
: Returns whether the vector is immutable (boolean
) -
oversized(cv)
: Returns whether the vector is oversized (boolean
)
-
split(cv)
: Splits the vector into its segments -
validate(cv)
: Asserts that the vector uses valid syntax