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.3 to 3.0.4

2

package.json
{
"name": "slashes",
"description": "Add or remove backslashes (escape or unescape).",
"version": "3.0.3",
"version": "3.0.4",
"license": "ISC",

@@ -6,0 +6,0 @@ "author": {

@@ -12,3 +12,3 @@ # Slashes

# Getting Started
# Getting started

@@ -22,3 +22,3 @@ ```ts

## Adding Slashes
## Adding slashes

@@ -47,2 +47,4 @@ By default, `addSlashes` will escape the following JSON-unsafe characters.

### Custom encoding
Escape encoding can be customized using the `getEscaped` option.

@@ -63,4 +65,10 @@

## Removing Slashes
A custom `getEscaped` receives one character (may be unicode) at a time. It can return `true` to use the standard escape sequence, `false` to not escape the character, or a string to provide a custom escape sequence (must begin with a backslash).
```ts
getEscaped(character: string): boolean | `\\${string}` | ''
```
## Removing slashes
The `removeSlashes` function will _always_ remove one layer of slashes.

@@ -83,2 +91,4 @@

### Custom decoding
Although it should generally not be necessary because all escapes are automatically handled, escape decoding can be customized using the `getUnescaped` option.

@@ -94,2 +104,10 @@

The `getUnescapedAny` implementation is the only one included.
Included `getUnescaped` implementations:
- `getUnescapedAny` - Decode _ANY_ Javascript supported escape sequence.
A custom `getUnescaped` implementation receives the escape sequence as the first argument, and the escape sequence code point number or `null` (for single letter escape sequences) as the second argument. It can return `true` to use standard decoding, `false` to treat the sequence as invalid (only removes the leading backslash), or a string to provide a custom decoded value for the escape sequence.
```ts
getUnescaped(sequence: `\\${string}`, code: number | null): boolean | string
```
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