13 lines
568 B
TypeScript
13 lines
568 B
TypeScript
import { Dominio } from './indicadores.models';
|
|
|
|
// JSON tuples preserve identity even when published IDs contain separators.
|
|
export function indicatorIdentity(domain: Dominio, indicator: string): string {
|
|
return JSON.stringify([domain, indicator]);
|
|
}
|
|
export function figureIdentity(domain: Dominio, indicator: string, figure: string): string {
|
|
return JSON.stringify([domain, indicator, figure]);
|
|
}
|
|
export function identityElementId(identity: string): string {
|
|
return 'indicadores-' + Array.from(identity, char => char.codePointAt(0)!.toString(16)).join('-');
|
|
}
|