diff --git a/LICENSE b/LICENSE index 777f1cc..6628827 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (C) 2022 Dmitry Shirokov +Copyright (C) 2023 Dmitry Shirokov Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/index.ts b/src/index.ts index a43ade3..7f519c8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -42,14 +42,15 @@ const recognisers: Recogniser[] = [ new sbcs.KOI8_R(), ]; -type DetectResult = Match[] | string | null; +export type AnalyseResult = Match[]; +export type DetectResult = string | null; export const detect = (buffer: Uint8Array): string | null => { const matches: Match[] = analyse(buffer); return matches.length > 0 ? matches[0].name : null; }; -export const analyse = (buffer: Uint8Array): Match[] => { +export const analyse = (buffer: Uint8Array): AnalyseResult => { // Tally up the byte occurrence statistics. const byteStats = []; for (let i = 0; i < 256; i++) byteStats[i] = 0;