video-ad-sdk
Version:
VAST/VPAID SDK that allows video ads to be played on top of any player
42 lines (41 loc) • 1.57 kB
TypeScript
import type { ParsedXML, Attributes, Optional } from '../../types';
/**
* Get the first child element from the passed parsed xml element.
*
* @param element Parsed xml element object.
* @param childName Child element name
* @returns The first child element with the passed name or undefined if not found.
*/
export declare const get: (element: ParsedXML, childName: string) => Optional<ParsedXML>;
/**
* Get all the children elements of the passed parsed xml element filtered by the passed child name if passed.
*
* @param element Parsed xml element object.
* @param childName Child element name.
* @returns Array of child elements or an empty array.
*/
export declare const getAll: (element: ParsedXML, childName?: string) => ParsedXML[];
/**
* Get the first child element from the passed parsed xml element.
*
* @returns The first child element or undefined if there are non.
*/
export declare const getFirstChild: (element: ParsedXML) => Optional<ParsedXML>;
/**
* Get the text value of the passed parsed xml element.
*
* @returns Text of the element
*/
export declare const getText: (element?: ParsedXML) => Optional<string>;
/**
* Get all the attributes of the passed parsed xml element.
*
* @returns Object with the element attributes.
*/
export declare const getAttributes: (element: ParsedXML) => Attributes;
/**
* Get the attribute with the passed name of the passed parsed xml element.
*
* @returns Attribute value or undefined.
*/
export declare const getAttribute: (element: ParsedXML, attributeName: string) => Optional<string>;