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

slashes

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slashes - npm Package Compare versions

Comparing version 3.0.7 to 3.0.8

2

lib/types/get-escaped-json-unsafe.d.ts
/**
* Get escapes for the default escape set, which is all characters that cannot
* be included in a JSON string literal.
* be used between double quotes in a JSON string.
*

@@ -5,0 +5,0 @@ * - `\b` Backspace

{
"name": "slashes",
"description": "Add or remove backslashes (escape or unescape).",
"version": "3.0.7",
"version": "3.0.8",
"license": "ISC",

@@ -6,0 +6,0 @@ "keywords": [

@@ -23,3 +23,3 @@ # Slashes

By default, `addSlashes` will escape the following JSON-unsafe characters.
By default, `addSlashes` will escape the following characters.

@@ -37,9 +37,9 @@ - Backspace (`\b`)

```ts
const encoded = addSlashes(`\n`); // "\\n"
const escaped = addSlashes(`\n`); // "\\n"
```
This default character set is the characters which cannot be included in a JSON string literal.
This default character set is the characters which cannot be used between double quotes in a JSON string.
```ts
const jsonString = `{ "value": "${encoded}" }`;
const jsonString = `{ "key": "${escaped}" }`;
```

@@ -61,3 +61,3 @@

- `getEscapedJsonUnsafe` - (Default) Encode characters which cannot be used between quotes in a JSON string.
- `getEscapedJsonUnsafe` - (Default) Encode characters which cannot be used between double quotes in a JSON string.
- `getEscapedAny` - Encode _ANY_ character to a single letter (eg. `\n`) or an ES5 Unicode (eg. `\u0100`) escape sequence.

@@ -64,0 +64,0 @@

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