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

escape-goat

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

escape-goat - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

32

index.js
'use strict';
const escapes = new Map([
['&', '&'],
['<', '&lt;'],
['>', '&gt;'],
['"', '&quot;'],
['\'', '&#39;']
]);
exports.escape = input => input
.replace(/&/g, '&amp;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#39;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;');
const unescapes = new Map([
['&amp;', '&'],
['&lt;', '<'],
['&gt;', '>'],
['&quot;', '"'],
['&#39;', '\'']
]);
exports.escape = input =>
input.replace(/[&<>"']/g, m => escapes.get(m) || m);
exports.unescape = input =>
input.replace(/&(?:amp|lt|gt|quot|#39);/g, m => unescapes.get(m) || m);
exports.unescape = input => input
.replace(/&amp;/g, '&')
.replace(/&quot;/g, '"')
.replace(/&#39;/g, '\'')
.replace(/&lt;/g, '<')
.replace(/&gt;/g, '>');
{
"name": "escape-goat",
"version": "1.0.1",
"version": "1.1.0",
"description": "Escape a string for use in HTML or the inverse",

@@ -5,0 +5,0 @@ "license": "MIT",

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