music-codes
Version:
Small library for music codes (ISRC, ISWC, UPC)
26 lines • 1.07 kB
TypeScript
import type { IterableCode } from './types.js';
export type GtinFormat = (typeof GtinFormats)[number];
export declare const GtinFormats: readonly ["GTIN-8", "GTIN-12", "GTIN-13", "GTIN-14", "GSIN", "SSCC"];
export declare const GtinFormatToLength: Record<GtinFormat, number>;
export declare const GtinLengthToFormat: Record<number, GtinFormat>;
export declare class GTIN implements IterableCode<GTIN> {
/** Code without check digit */
readonly code: bigint;
/** Check digit */
readonly check: number;
/** Length of the GTIN format */
readonly length: number;
/** Prefix to adhere to */
readonly prefix: string | undefined;
constructor(gtin: string, prefix?: string | undefined, verify?: boolean);
get gtinFormat(): string;
get realGtinFormat(): string;
first(): GTIN;
last(): GTIN;
previous(): GTIN;
next(): GTIN;
iterate(up?: boolean): IterableIterator<GTIN>;
toString(): string;
}
export declare function getGtinFromPrefix(prefix: string, length: number): GTIN;
//# sourceMappingURL=gtin.d.ts.map