web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
2.6 KiB

  1. # entities [![NPM version](http://img.shields.io/npm/v/entities.svg)](https://npmjs.org/package/entities) [![Downloads](https://img.shields.io/npm/dm/entities.svg)](https://npmjs.org/package/entities) [![Build Status](http://img.shields.io/travis/fb55/entities.svg)](http://travis-ci.org/fb55/entities) [![Coverage](http://img.shields.io/coveralls/fb55/entities.svg)](https://coveralls.io/r/fb55/entities)
  2. Encode & decode HTML & XML entities with ease & speed.
  3. ## How to…
  4. ### …install `entities`
  5. npm install entities
  6. ### …use `entities`
  7. ```javascript
  8. const entities = require("entities");
  9. //encoding
  10. entities.escape("&"); // "&"
  11. entities.encodeXML("&"); // "&"
  12. entities.encodeHTML("&"); // "&"
  13. //decoding
  14. entities.decodeXML("asdf & ÿ ü '"); // "asdf & ÿ ü '"
  15. entities.decodeHTML("asdf & ÿ ü '"); // "asdf & ÿ ü '"
  16. ```
  17. ## Performance
  18. This is how `entities` compares to other libraries on a very basic benchmark
  19. (see `scripts/benchmark.ts`, for 10,000,000 iterations):
  20. | Library | `decode` performance | `encode` performance | Bundle size |
  21. | -------------- | -------------------- | -------------------- | -------------------------------------------------------------------------- |
  22. | entities | 10.809s | 17.683s | ![npm bundle size](https://img.shields.io/bundlephobia/min/entities) |
  23. | html-entities | 14.029s | 22.670s | ![npm bundle size](https://img.shields.io/bundlephobia/min/html-entities) |
  24. | he | 16.163s | 44.010s | ![npm bundle size](https://img.shields.io/bundlephobia/min/he) |
  25. | parse-entities | 28.507s | N/A | ![npm bundle size](https://img.shields.io/bundlephobia/min/parse-entities) |
  26. ---
  27. License: BSD-2-Clause
  28. ## Security contact information
  29. To report a security vulnerability, please use the
  30. [Tidelift security contact](https://tidelift.com/security). Tidelift will
  31. coordinate the fix and disclosure.
  32. ## `entities` for enterprise
  33. Available as part of the Tidelift Subscription
  34. The maintainers of `entities` and thousands of other packages are working with
  35. Tidelift to deliver commercial support and maintenance for the open source
  36. dependencies you use to build your applications. Save time, reduce risk, and
  37. improve code health, while paying the maintainers of the exact dependencies you
  38. use.
  39. [Learn more.](https://tidelift.com/subscription/pkg/npm-entities?utm_source=npm-entities&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)