JSPM

xml-fns

0.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q28506F
  • License CC0-1.0

Higher Level XML Utility Functions

Package Exports

  • xml-fns
  • xml-fns/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (xml-fns) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

xml-fns

Higher Level XML Utility Functions

install

npm install xml-fns

usage

findTagText

import { findTagText } from "xml-fns/findTagText.js"

const xml = `
<item>
  <title>
    My Article
  </title>
</item>
`;

// by tag name
findTagText(xml, "title"); // "My Article"

hasTag

import { hasTag } from "xml-fns/hasTag.js"

const xml = `
<item>
  <title>My Article</title>
</item>
`;

// by tag name
hasTag(xml, "title"); // true

// by tag path
hasTag(xml, ["item", "title"]); // true

hasAllTags

import { hasAllTags } from "xml-fns/hasAllTags.js"

const xml = `
<item>
  <title>My Article</title>
  <geo:lat>5.5319</geo:lat>
  <geo:long>95.8972</geo:long>  
</item>
`;

// by tag names
hasAllTags(xml, ["geo:lat", "geo:long"]); // true

// by tag paths
hasAllTags(xml, [["item", "geo:lat"], ["item", "geo:long"]]); // true