# xml-escape

> Escape XML

Latest version **1.1.0** (published 2016-03-14) · MIT License license · 0 weekly downloads

## Install

```sh
npm install xml-escape
pnpm add xml-escape
yarn add xml-escape
bun add xml-escape
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2016-03-14 |
| First published | 2014-02-14 |
| Weekly downloads | 0 |
| License | MIT License |
| TypeScript types | separate (@types/xml-escape) |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 19 |
| Author | Michael Hernandez - michael.hernandez1988@gmail.com |
| Maintainers | mhernandez |
| Keywords | Escape, XML, Unesacpe, encoding, xml-escape |

## Links

- npm: https://www.npmjs.com/package/xml-escape
- Repository: https://github.com/miketheprogrammer/xml-escape
- Issues: https://github.com/miketheprogrammer/xml-escape/issues
- npm.io page: https://npm.io/package/xml-escape

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2016-03-14
- 1.0.0 — 2014-02-14

## README

xml-escape
==========

Escape XML in javascript (NodeJS)

npm install xml-escape

```javascript
// Warning escape is a reserved word, so maybe best to use xmlescape for var name
var xmlescape = require('xml-escape');

xmlescape('"hello" \'world\' & false < true > -1');

// output
// '&quot;hello&quot; &apos;world&apos; &amp; false &lt; true &gt; -1'

// don't escape some characters
xmlescape('"hello" \'world\' & false < true > -1', '>"&')

// output
// '"hello" &apos;world&apos; & false &lt; true > -1'
```


There is also now an ignore function thanks to @jayflo

```javascript
esc = require('./');

ignore = '"<&'
// note you should never ignore an &
output = esc('I am "<&not>" escaped', ignore)
console.log(output)

//I am "<&not&gt;" escaped
```

[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/miketheprogrammer/xml-escape/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

---
_Source: https://npm.io/package/xml-escape · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
