htmlescape

WebJar for htmlescape

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

htmlescape
Last Version

Last Version

1.1.1
Release Date

Release Date

Type

Type

jar
Description

Description

htmlescape
WebJar for htmlescape
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/zertosh/htmlescape

Download htmlescape

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/htmlescape/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>htmlescape</artifactId>
    <version>1.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/htmlescape/
implementation 'org.webjars.npm:htmlescape:1.1.1'
// https://jarcasting.com/artifacts/org.webjars.npm/htmlescape/
implementation ("org.webjars.npm:htmlescape:1.1.1")
'org.webjars.npm:htmlescape:jar:1.1.1'
<dependency org="org.webjars.npm" name="htmlescape" rev="1.1.1">
  <artifact name="htmlescape" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='htmlescape', version='1.1.1')
)
libraryDependencies += "org.webjars.npm" % "htmlescape" % "1.1.1"
[org.webjars.npm/htmlescape "1.1.1"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

htmlescape

Properly escape JSON for usage as an object literal inside of a <script> tag. Use htmlescape in place of JSON.stringify. For more info see JSON: The JavaScript subset that isn't.

Transformations

from to
& \\u0026
> \\u003e
< \\u003c
\u2028 \\u2028
\u2029 \\u2029

Usage

var htmlescape = require('htmlescape');
htmlescape({prop:'value'});
//=> '{"prop":"value"}'

Or in your templates:

<script>
var payload = <%= htmlescape(payload) %>;
</script>

Versions

Version
1.1.1
1.1.0