kinoklub-api
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -14,7 +14,7 @@ import { HTMLElement } from 'node-html-parser'; | ||
export declare const getImage: (el: HTMLElement) => string; | ||
export declare const getTitleOriginal: (info: string[]) => { | ||
export declare const pickInfo: (info: string[], parseString: string) => { | ||
text: string; | ||
index: number; | ||
}; | ||
export declare const pickInfo: (info: string[], parseString: string) => { | ||
export declare const getTitleOriginal: (info: string[]) => { | ||
text: string; | ||
@@ -21,0 +21,0 @@ index: number; |
@@ -47,10 +47,6 @@ import { resolveCinema, resolveDate } from './global.helper.js'; | ||
}; | ||
export const getTitleOriginal = (info) => { | ||
return (pickInfo(info, 'Originální název:') || | ||
pickInfo(info, 'Original title:') || { text: null, index: null }); | ||
}; | ||
export const pickInfo = (info, parseString) => { | ||
const index = info.findIndex((x) => x.includes(parseString)); | ||
const pickedInfo = info[index]; | ||
if (index && pickedInfo) { | ||
if (index !== -1 && pickedInfo) { | ||
return { text: pickedInfo.split(parseString)[1].trim(), index }; | ||
@@ -60,2 +56,6 @@ } | ||
}; | ||
export const getTitleOriginal = (info) => { | ||
return (pickInfo(info, 'Originální název:') || | ||
pickInfo(info, 'Original title:') || { text: null, index: null }); | ||
}; | ||
export const getDirector = (info) => { | ||
@@ -62,0 +62,0 @@ return pickInfo(info, 'režie:') || pickInfo(info, 'director:') || { text: null, index: null }; |
{ | ||
"name": "kinoklub-api", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Support library for KinoKlub", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
23732