Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@xmpp/xml

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xmpp/xml - npm Package Compare versions

Comparing version 0.12.0 to 0.12.1

14

lib/Element.js

@@ -10,10 +10,10 @@ "use strict";

} else if (attrs) {
Object.keys(attrs).forEach((key) => {
for (const key of Object.keys(attrs)) {
// https://github.com/facebook/react/pull/4596
// https://www.npmjs.com/package/babel-plugin-transform-react-jsx-source
if (key === "__source" || key === "__self") return;
if (key === "__source" || key === "__self") continue;
const val = attrs[key];
if (val !== undefined && val !== null)
this.attrs[key.toString()] = val.toString();
}, this);
}
}

@@ -24,3 +24,3 @@ }

nodes = Array.isArray(nodes) ? nodes : [nodes];
nodes.forEach((node) => {
for (const node of nodes) {
this.children.push(node);

@@ -30,3 +30,3 @@ if (typeof node === "object") {

}
});
}
return this;

@@ -37,3 +37,3 @@ }

nodes = Array.isArray(nodes) ? nodes : [nodes];
nodes.forEach((node) => {
for (const node of nodes) {
this.children.unshift(node);

@@ -43,3 +43,3 @@ if (typeof node === "object") {

}
});
}
return this;

@@ -46,0 +46,0 @@ }

@@ -10,3 +10,3 @@ "use strict";

} else if (Array.isArray(child)) {
child.forEach((c) => append(el, c));
for (const c of child) append(el, c);
} else {

@@ -13,0 +13,0 @@ el.append(String(child));

@@ -5,5 +5,5 @@ {

"repository": "github:xmppjs/xmpp.js",
"homepage": "https://github.com/xmppjs/xmpp.js/tree/master/packages/xml",
"homepage": "https://github.com/xmppjs/xmpp.js/tree/main/packages/xml",
"bugs": "http://github.com/xmppjs/xmpp.js/issues",
"version": "0.12.0",
"version": "0.12.1",
"license": "ISC",

@@ -21,4 +21,3 @@ "keywords": [

"engines": {
"node": ">= 12.4.0",
"yarn": ">= 1.0.0"
"node": ">= 12.4.0"
},

@@ -28,3 +27,3 @@ "publishConfig": {

},
"gitHead": "75f7bdf7805dced03f616b66dc16e2a067b46480"
"gitHead": "7f5ab599874eef1b557803c96fa3141e53520ea9"
}

@@ -5,5 +5,5 @@ # xml

Note, if you're using `@xmpp/client` or `@xmpp/component`, you don't need to install `@xmpp/xml` yourself.
Note, if you're using `@xmpp/client` or `@xmpp/component`, you don't need to install `@xmpp/xml`.
`npm install @xmpp/xml` or `yarn add @xmpp/xml`
`npm install @xmpp/xml`

@@ -68,3 +68,3 @@ ```js

Requires a [preprocessor](https://www.npmjs.com/package/babel-plugin-transform-react-jsx) such as [Babel](http://babeljs.io/) with [@babel/plugin-transform-react-jsx](https://babeljs.io/docs/en/next/babel-plugin-transform-react-jsx.html).
Requires a preprocessor such as [TypeScript](https://www.typescriptlang.org/) or [Babel](http://babeljs.io/) with [@babel/plugin-transform-react-jsx](https://babeljs.io/docs/en/next/babel-plugin-transform-react-jsx.html).

@@ -208,3 +208,3 @@ ## Reading

You can embed JSON anywhere but it is recommended to use an appropriate semantic.
You can embed JSON anywhere but it is recommended to use appropriate semantic.

@@ -229,2 +229,29 @@ ```js

See [JSON Containers](https://xmpp.org/extensions/xep-0335.html)
See also [JSON Containers](https://xmpp.org/extensions/xep-0335.html) and [Simple JSON Messaging](https://xmpp.org/extensions/xep-0432.html).
## Parsing XML strings
`@xmpp/xml` include a function to parse XML strings.
⚠ Use with care. Untrusted input or substitutions can result in invalid XML and side effects.
```js
const { escapeXML, escapeXMLText };
const parse = require("@xmpp/xml/lib/parse");
const ctx = parse("<message><body>hello world</body></message>");
ctx.getChildText("body"); // hello world
```
If you must use with untrusted input, escape it with `escapeXML` and `escapeXMLText`.
```js
const { escapeXML, escapeXMLText } = require("@xmpp/xml");
const parse = require("@xmpp/xml/lib/parse");
const message = parse(`
<message to="${escapeXML(to)}">
<body>${escapeXMLText(body)}</body>
</message>,
`);
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc