Comparing version 0.3.9 to 0.4.0
{ | ||
"name": "esmock", | ||
"version": "0.3.9", | ||
"version": "0.4.0", | ||
"license": "MIT", | ||
@@ -53,7 +53,6 @@ "readmeFilename": "README.md", | ||
"ava": "^4.0.0-alpha.2", | ||
"babel-eslint": "^10.1.0", | ||
"eslint": "^7.17.0", | ||
"form-urlencoded": "^4.2.1", | ||
"eslint": "^7.32.0", | ||
"form-urlencoded": "4.2.1", | ||
"import-local": "3.0.2", | ||
"sinon": "^10.0.0" | ||
"sinon": "^11.1.2" | ||
}, | ||
@@ -60,0 +59,0 @@ "scripts": { |
@@ -54,2 +54,4 @@ esmock | ||
* 0.4.0 _Sep.07.2021_ | ||
* do not runtime error when returuning type '[object Module]' default | ||
* 0.3.9 _May.05.2021_ | ||
@@ -56,0 +58,0 @@ * small change to README |
@@ -68,5 +68,10 @@ import fs from 'fs'; | ||
const esmockModuleImportedSanitize = importedModule => { | ||
if ('default' in importedModule | ||
&& !/boolean|string|number/.test(typeof importedModule.default)) { | ||
return Object.assign(importedModule.default, importedModule); | ||
const importedDefault = 'default' in importedModule | ||
&& importedModule.default; | ||
if (!/boolean|string|number/.test(typeof importedDefault)) { | ||
// an example of [object Module]: import * as mod from 'fs'; export mod; | ||
return Object.prototype.toString.call(importedDefault) === '[object Module]' | ||
? Object.assign({}, importedDefault, importedModule) | ||
: Object.assign(importedDefault, importedModule); | ||
} | ||
@@ -73,0 +78,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15509
5
268
82