1. escape-html
Escape string for use in HTML
escape-html
Package: escape-html
Created by: component
Last modified: Thu, 16 Nov 2023 17:38:16 GMT
Version: 1.0.3
License: MIT
Downloads: 121,890,155
Repository: https://github.com/component/escape-html

Install

npm install escape-html
yarn add escape-html

escape-html

Escape string for use in HTML

Example

 var escape = require('escape-html');
var html = escape('foo & bar');
// -> foo & bar

Benchmark

$ npm run-script bench

> [email protected] bench nodejs-escape-html
> node benchmark/index.js


  [email protected]
  [email protected]
  [email protected]
  [email protected]
  [email protected]
  [email protected]
  modules@11
  [email protected]

  1 test completed.
  2 tests completed.
  3 tests completed.

  no special characters    x 19,435,271 ops/sec ±0.85% (187 runs sampled)
  single special character x  6,132,421 ops/sec ±0.67% (194 runs sampled)
  many special characters  x  3,175,826 ops/sec ±0.65% (193 runs sampled)

License

MIT

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code