dom.ts 308 B

1234567891011
  1. export const canUseDOM = (): boolean => (
  2. !!(typeof window !== 'undefined' && window.document)
  3. );
  4. export const xmlParser = (xmlString: string): any => {
  5. const parser = new window.DOMParser();
  6. const xmlDoc = parser.parseFromString(xmlString, 'text/xml');
  7. return xmlDoc;
  8. };
  9. export default canUseDOM;