Socket
Socket
Sign inDemoInstall

rewire

Package Overview
Dependencies
Maintainers
2
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rewire - npm Package Compare versions

Comparing version 2.3.2 to 2.3.3

3

CHANGELOG.md
Changelog
---------
### 2.3.3
- Fix issue where the strict mode was not detected when a comment was before "strict mode"; [#54](https://github.com/jhnns/rewire/issues/54)
### 2.3.2

@@ -5,0 +8,0 @@ - Fix a problem when a function declaration had the same name as a global variable [#56](https://github.com/jhnns/rewire/issues/56)

@@ -0,1 +1,5 @@

var multiLineComment = /^\s*\/\*.*?\*\//;
var singleLineComment = /^\s*\/\/.*?[\r\n]/;
var strictMode = /^\s*(?:"use strict"|'use strict')[ \t]*(?:[\r\n]|;)/;
/**

@@ -9,5 +13,17 @@ * Returns true if the source code is intended to run in strict mode. Does not detect

function detectStrictMode(src) {
return (/^\s*(?:"use strict"|'use strict')[ \t]*(?:[\r\n]|;)/g).test(src);
var singleLine;
var multiLine;
while ((singleLine = singleLineComment.test(src)) || (multiLine = multiLineComment.test(src))) {
if (singleLine) {
src = src.replace(singleLineComment, "");
}
if (multiLine) {
src = src.replace(multiLineComment, "");
}
}
return strictMode.test(src);
}
module.exports = detectStrictMode;
module.exports = detectStrictMode;

2

package.json
{
"name": "rewire",
"version": "2.3.2",
"version": "2.3.3",
"description": "Easy dependency injection for node.js unit testing",

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

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