Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

entity-convert

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

entity-convert

convert all special characters in a string to their corresponding HTML and CSS entities

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

entityconvert.js

convert special characters in a string to their HTML or CSS charcode entities (useful for build tools et. al.)

The module works as AMD or CommonJS module and exports an Object exposing two methods: .html(string) and .css(string). In a non-AMD and non-CommonJS environment .entityconvert will be attached to the global object.

AMD usage:

require(['entityconvert'], function(entityconvert){
    var converted = entityconvert.html('We äll löve Ümläutß!');
    // => We äll löve Ümläutß!
});

CommonJS usage:

var entityconvert = require('entity-convert');
var converted = entityconvert.css('We äll löve Ümläutß!');
// => We \00e4ll l\00f6ve \00dcml\00e4ut\00df!

Script tag usage:

<script src="entityconvert.js"></script>
<script>
	var converted = entityconvert.html('Yäy!');
	// => Y&#228;y!
</script>

Available via npm:

npm install entity-convert --save

##License MIT © Frederik Ring

Keywords

FAQs

Package last updated on 24 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc