js-string-escape

WebJar for js-string-escape

Лицензия

Лицензия

MIT
Категории

Категории

JavaScript Языки программирования
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

js-string-escape
Последняя версия

Последняя версия

1.0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

js-string-escape
WebJar for js-string-escape
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/joliss/js-string-escape

Скачать js-string-escape

Как подключить последнюю версию

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

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

js-string-escape

Build Status

Escape any string to be a valid JavaScript string literal between double quotes or single quotes.

Installation

npm install js-string-escape

Example

If you need to generate JavaScript output, this library will help you safely put arbitrary data in JavaScript strings:

jsStringEscape = require('js-string-escape')

console.log('"' + jsStringEscape('Quotes (\", \'), newlines (\n), etc.') + '"')
// => "Quotes (\", \'), newlines (\n), etc."

In other words, given any string s, the following invariants hold:

eval('"' + jsStringEscape(s) + '"') === s
eval("'" + jsStringEscape(s) + "'") === s

These eval expressions are safe with untrusted strings s.

Non-strings will be cast to strings.

Compliance

This library has been checked against ECMAScript 5.1 and tested against all Unicode code points.

Note that the returned string is not necessarily valid JSON, since JSON disallows control characters, and \' is illegal in JSON.

Версии библиотеки

Версия
1.0.1
1.0.0