Convert all applicable characters to HTML entities.
Install
Install all functions of strman
yarn add strman
or just the htmlEncode function
yarn add strman.htmlencode
Usage
import { htmlEncode } from 'strman'
// OR
import htmlEncode from 'strman.htmlencode'
Parameters:
Name | Type | Description |
---|---|---|
value |
String | value to encode. |
- Source:
Returns:
The encoded data.
- Type
- String
Example
htmlEncode('<div>')
// => '<div>'