guessit-js 4.11.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -10,6 +10,8 @@
10
10
  export { guessit, guessitMany, properties, configure, reset, defaultApi, GuessItApi, GuessItException } from './api.js';
11
11
  export type { GuessItBatchEntry } from './api.js';
12
12
  export { GUESSIT_SCHEMA } from './schema.js';
13
+ export { toPythonNotation, pythonLanguageName, pythonCountryName, OUTPUT_FORMATS } from './output.js';
14
+ export type { OutputFormat } from './output.js';
13
15
  export type { GuessItResult, GuessitLanguage, PropertySchema } from './schema.js';
14
16
  export { parseOptions, loadConfig, mergeOptions } from './options.js';
15
17
  export type { GuessItOptions, RawOptions } from './options.js';
@@ -0,0 +1,2 @@
1
+ export declare const PYTHON_LANGUAGE_NAMES: Record<string, string>;
2
+ export declare const PYTHON_COUNTRY_NAMES: Record<string, string>;
package/dist/options.d.ts CHANGED
@@ -14,6 +14,13 @@ export interface GuessItOptions {
14
14
  singleValue?: boolean;
15
15
  enforceList?: boolean;
16
16
  outputInputString?: boolean;
17
+ /**
18
+ * Value notation. 'python' (default): Python guessit's JSON notation, language
19
+ * and country names ("French", "UNITED STATES") and "YYYY-MM-DD" dates.
20
+ * 'codes': guessit-js native values, `{ alpha3, country? }` language objects,
21
+ * ISO alpha-2 countries and Date objects.
22
+ */
23
+ output?: 'python' | 'codes';
17
24
  noUserConfig?: boolean;
18
25
  noDefaultConfig?: boolean;
19
26
  advancedConfig?: Record<string, unknown>;
@@ -0,0 +1,14 @@
1
+ export type OutputFormat = 'python' | 'codes';
2
+ /** The output formats `guessit()` accepts as `options.output`. */
3
+ export declare const OUTPUT_FORMATS: readonly OutputFormat[];
4
+ /** Python guessit's name for an ISO 639-3 code ("fra" → "French"); unknown codes pass through. */
5
+ export declare function pythonLanguageName(alpha3: string): string;
6
+ /** Python guessit's name for an ISO 3166 alpha-2 code ("US" → "UNITED STATES"); unknown codes pass through. */
7
+ export declare function pythonCountryName(alpha2: string): string;
8
+ /**
9
+ * Convert a guessit-js result (codes notation) to Python guessit's notation.
10
+ * Returns a new object; the input is not modified.
11
+ */
12
+ export declare function toPythonNotation<T extends Record<string, unknown>>(result: T): T;
13
+ /** Normalise an `output` option value; throws on anything but 'python' / 'codes'. */
14
+ export declare function parseOutputFormat(value: unknown): OutputFormat;
package/dist/schema.d.ts CHANGED
@@ -1,4 +1,7 @@
1
- /** A detected language or country, as guessit renders it. */
1
+ /**
2
+ * A language as returned with `output: 'codes'`. The default output gives the
3
+ * name Python guessit prints instead ("French").
4
+ */
2
5
  export interface GuessitLanguage {
3
6
  name?: string;
4
7
  alpha3?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "guessit-js",
3
- "version": "4.11.0",
3
+ "version": "5.0.0",
4
4
  "description": "Extract metadata (title, year, season, episode, codec, language, etc.) from media filenames — TypeScript port of Python guessit",
5
5
  "keywords": [
6
6
  "guessit",