hypertune
Version:
[Hypertune](https://www.hypertune.com/) is the most flexible platform for feature flags, A/B testing, analytics and app configuration. Built with full end-to-end type-safety, Git-style version control and local, synchronous, in-memory flag evaluation. Opt
18 lines (13 loc) • 469 B
text/typescript
import { HashData } from "../types";
const separator = "_";
export function formatHashData({ commitId, hash }: HashData): string {
return `${commitId}${separator}${hash}`;
}
export function parseHashData(data: string): HashData | null {
const [rawCommitId, ...hash] = data.split(separator);
const commitId = parseInt(rawCommitId);
if (!hash || !commitId || Number.isNaN(commitId)) {
return null;
}
return { commitId, hash: hash.join(separator) };
}