1 |
3a515b92
|
cagy
|
|
2 |
|
|
# escape-html
|
3 |
|
|
|
4 |
|
|
Escape string for use in HTML
|
5 |
|
|
|
6 |
|
|
## Example
|
7 |
|
|
|
8 |
|
|
```js
|
9 |
|
|
var escape = require('escape-html');
|
10 |
|
|
var html = escape('foo & bar');
|
11 |
|
|
// -> foo & bar
|
12 |
|
|
```
|
13 |
|
|
|
14 |
|
|
## Benchmark
|
15 |
|
|
|
16 |
|
|
```
|
17 |
|
|
$ npm run-script bench
|
18 |
|
|
|
19 |
|
|
> escape-html@1.0.3 bench nodejs-escape-html
|
20 |
|
|
> node benchmark/index.js
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
http_parser@1.0
|
24 |
|
|
node@0.10.33
|
25 |
|
|
v8@3.14.5.9
|
26 |
|
|
ares@1.9.0-DEV
|
27 |
|
|
uv@0.10.29
|
28 |
|
|
zlib@1.2.3
|
29 |
|
|
modules@11
|
30 |
|
|
openssl@1.0.1j
|
31 |
|
|
|
32 |
|
|
1 test completed.
|
33 |
|
|
2 tests completed.
|
34 |
|
|
3 tests completed.
|
35 |
|
|
|
36 |
|
|
no special characters x 19,435,271 ops/sec ±0.85% (187 runs sampled)
|
37 |
|
|
single special character x 6,132,421 ops/sec ±0.67% (194 runs sampled)
|
38 |
|
|
many special characters x 3,175,826 ops/sec ±0.65% (193 runs sampled)
|
39 |
|
|
```
|
40 |
|
|
|
41 |
|
|
## License
|
42 |
|
|
|
43 |
|
|
MIT
|