@brizy/media-gallery
Version:
30 lines (29 loc) • 770 B
TypeScript
import { NewType } from "~/types/NewType";
import { Id } from "~/utils/number/Id";
declare enum name {
type = "name"
}
export type Name = NewType<string, name>;
/**
* Check if the string value is a Name value
*/
export declare const is: (s: string) => s is Name;
/**
* Try to read a Name value from a string
*/
export declare const fromString: (v: string) => Name;
/**
* from name to string
*/
export declare const toString: (v: Name) => string;
/**
* Create a Name value from an numeric Id
*/
export declare const fromId: (id: Id) => Name;
/**
* Converts a Name value to an numeric Id
*
* Note: A Name value contains a Id value inside, so we can afford this dangerous forced conversion to Id
*/
export declare const toId: (name: Name) => Id;
export {};