UNPKG

s2-tools

Version:

A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.

99 lines 3.45 kB
/** XMLOptions for xml parsing */ export interface XMLOptions { debug?: boolean; startIndex?: number; nested?: boolean; returnOnFirst?: boolean; } /** A Tag is a pair of an inner and an outer strings with their indexes */ export interface XMLTag { inner: null | string; outer: string; start: number; end: number; } /** A Step is a name and an index */ export interface XMLStep { name: string; index?: number | undefined | null; } /** A Path is an array of Steps or Strings */ export type XMLPath = Array<string | XMLStep> | ReadonlyArray<string | XMLStep>; /** * Count the number of times a substring appears in a string * @param string - the string * @param substring - the substring * @returns the number of times the substring appears in the string */ export declare function xmlCountSubstring(string: string, substring: string): number; /** * Find the first tag with the given name * @param xml - the xml string * @param tagName - the tag name * @param options - user defined options * @returns the first tag with the given name */ export declare function xmlFindTagByName(xml: string, tagName: string, options?: XMLOptions): XMLTag | undefined; /** * Find the first tag with the given path * @param xml - the xml string * @param path - the path * @param options - user defined options * @returns the first tag with the given path */ export declare function xmlFindTagByPath(xml: string, path: XMLPath, options?: XMLOptions): XMLTag | undefined; /** * Find all tags with the given name * @param xml - the xml string * @param tagName - the tag name * @param options - user defined options * @returns all tags with the given name */ export declare function xmlFindTagsByName(xml: string, tagName: string, options?: XMLOptions): XMLTag[]; /** * Find all tags with the given path * @param xml - the xml string * @param path - the path * @param options - user defined options * @returns all tags with the given path */ export declare function xmlFindTagsByPath(xml: string, path: XMLPath, options?: XMLOptions): XMLTag[]; /** * Get the value of an attribute * @param tag - the tag * @param attributeName - the attribute name * @param options - user defined options * @returns the attribute value */ export declare function xmlGetAttribute(tag: string | XMLTag, attributeName: string, options?: XMLOptions): string | undefined; /** * Find the index of the last match * @param xml - the xml string * @param pattern - the pattern * @param startIndex - the start index * @returns the index of the last match */ export declare function xmlIndexOfMatchEnd(xml: string, pattern: string, startIndex: number): number; /** * Find the index of the first match * @param xml - the xml string * @param pattern - the pattern * @param startIndex - the start index * @returns the index of the first match */ export declare function xmlIndexOfMatch(xml: string, pattern: string, startIndex: number): number; /** * Remove comments * @param xml - the xml string * @returns the xml without comments */ export declare function xmlRemoveComments(xml: string): string; /** * Remove tags * @param xml - the xml string * @param tagName - the tag name * @param options - user defined options * @returns the xml without the given tag */ export declare function xmlRemoveTagsByName(xml: string, tagName: string, options?: XMLOptions): string; //# sourceMappingURL=parsing.d.ts.map