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

@handy-common-utils/misc-utils

Package Overview
Dependencies
Maintainers
0
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@handy-common-utils/misc-utils - npm Package Compare versions

Comparing version 1.6.0 to 1.6.1

8

dist/codec.d.ts

@@ -65,12 +65,12 @@ /**

* @param text the string literal to be escaped
* @returns escaped string that can be used inside of RegExp
* @returns escaped string that can be used inside of RegExp, or an empty string if the input is null or undefined
*/
export declare function escapeForRegExp(text: string): string;
export declare function escapeForRegExp(text: string | undefined | null): string;
/**
* Escape replacement string for using it inside of RegExp replacement parameter.
* (From: https://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex)
* @param text the replacement string to be escaped
* @param text the replacement string to be escaped, or an empty string if the input is null or undefined
* @returns escaped replacement string that can be used inside of RegExp replacement parameter
*/
export declare function escapeForRegExpReplacement(text: string): string;
export declare function escapeForRegExpReplacement(text: string | undefined | null): string;
//# sourceMappingURL=codec.d.ts.map

@@ -117,5 +117,8 @@ "use strict";

* @param text the string literal to be escaped
* @returns escaped string that can be used inside of RegExp
* @returns escaped string that can be used inside of RegExp, or an empty string if the input is null or undefined
*/
function escapeForRegExp(text) {
if (text == null) {
return '';
}
// eslint-disable-next-line unicorn/better-regex

@@ -128,8 +131,11 @@ return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string

* (From: https://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex)
* @param text the replacement string to be escaped
* @param text the replacement string to be escaped, or an empty string if the input is null or undefined
* @returns escaped replacement string that can be used inside of RegExp replacement parameter
*/
function escapeForRegExpReplacement(text) {
if (text == null) {
return '';
}
return text.replace(/\$/g, '$$$$');
}
exports.escapeForRegExpReplacement = escapeForRegExpReplacement;
{
"name": "@handy-common-utils/misc-utils",
"version": "1.6.0",
"version": "1.6.1",
"description": "Miscellaneous utilities",

@@ -5,0 +5,0 @@ "scripts": {

@@ -666,3 +666,3 @@ # @handy-common-utils/misc-utils

| :------ | :------ | :------ |
| `text` | `string` | the string literal to be escaped |
| `text` | `undefined` \| ``null`` \| `string` | the string literal to be escaped |

@@ -673,3 +673,3 @@ ###### Returns

escaped string that can be used inside of RegExp
escaped string that can be used inside of RegExp, or an empty string if the input is null or undefined

@@ -689,3 +689,3 @@ ___

| :------ | :------ | :------ |
| `text` | `string` | the replacement string to be escaped |
| `text` | `undefined` \| ``null`` \| `string` | the replacement string to be escaped, or an empty string if the input is null or undefined |

@@ -692,0 +692,0 @@ ###### Returns

Sorry, the diff of this file is not supported yet

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