1.0.3 • Published 6 years ago

htmlchars2sql v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

htmlChars2Sql

Conversion of html special characters for sql

Usage

import htmlChars2Sql from 'htmlChars2Sql'

htmlChars2Sql(`<div>"Hello world"</div>`)

Example

import htmlChars2Sql from 'htmlChars2Sql'

var singleQuotes = `<div>'Single quotes'</div>`
var doubleQuotation = `<div>"Double quotation"</div>`
var ampersand = `<div>& ampersand</div>`
var lineBreak = `<div>\n lineBreak</div>`
var mix = `<div>Single quotes:' Double quotation:" ampersand:& lineBreak:\n</div>`

htmlChars2Sql(singleQuotes)         //<div>&#039;Single quotes&#039;</div>
htmlChars2Sql(doubleQuotation)      //<div>&quot;Double quotation&quot;</div>
htmlChars2Sql(ampersand)            //<div>&amp; ampersand</div>
htmlChars2Sql(lineBreak)            //<div><br> lineBreak</div>
htmlChars2Sql(mix)                  //<div>Single quotes:&#039; Double quotation:&quot; ampersand:&amp; backslash:<br></div>