htmlchars2sql

1.0.3 • Public • Published

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>

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i htmlchars2sql

      Weekly Downloads

      2

      Version

      1.0.3

      License

      ISC

      Unpacked Size

      1.71 kB

      Total Files

      3

      Last publish

      Collaborators

      • hjdtl