You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

jest-mock

Package Overview
Dependencies
Maintainers
4
Versions
237
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 14.3.0-alpha.d13c163e to 14.3.1-alpha.410cb91a

114

build/index.js

@@ -24,53 +24,56 @@ /**

const RESERVED_KEYWORDS = [
'do',
'if',
'in',
'for',
'let',
'new',
'try',
'var',
'case',
'else',
'enum',
'eval',
'null',
'this',
'true',
'void',
'with',
'await',
'break',
'catch',
'class',
'const',
'false',
'super',
'throw',
'while',
'yield',
'delete',
'export',
'import',
'public',
'return',
'static',
'switch',
'typeof',
'default',
'extends',
'finally',
'package',
'private',
'continue',
'debugger',
'function',
'arguments',
'interface',
'protected',
'implements',
'instanceof'];
const MOCK_CONSTRUCTOR_NAME = 'mockConstructor';
// $FlowFixMe
const RESERVED_KEYWORDS = Object.assign(Object.create(null), {
do: true,
if: true,
in: true,
for: true,
let: true,
new: true,
try: true,
var: true,
case: true,
else: true,
enum: true,
eval: true,
null: true,
this: true,
true: true,
void: true,
with: true,
await: true,
break: true,
catch: true,
class: true,
const: true,
false: true,
super: true,
throw: true,
while: true,
yield: true,
delete: true,
export: true,
import: true,
public: true,
return: true,
static: true,
switch: true,
typeof: true,
default: true,
extends: true,
finally: true,
package: true,
private: true,
continue: true,
debugger: true,
function: true,
arguments: true,
interface: true,
protected: true,
implements: true,
instanceof: true });
function isA(typeName, value) {

@@ -157,3 +160,4 @@ return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';

let name = metadata.name;
if (!name) {
// Special case functions named `mockConstructor` to guard for infinite loops.
if (!name || name === MOCK_CONSTRUCTOR_NAME) {
return mockConstructor;

@@ -176,11 +180,15 @@ }

// as name.
if (RESERVED_KEYWORDS.indexOf(name) !== -1) {
if (RESERVED_KEYWORDS[name]) {
name = '$' + name;
}
if (/\s/.test(name)) {
name = name.replace(/\s/g, '$');
}
/* eslint-disable no-new-func */
return new Function(
'mockConstructor',
MOCK_CONSTRUCTOR_NAME,
'return function ' + name + '() {' +
'return mockConstructor.apply(this,arguments);' +
'return ' + MOCK_CONSTRUCTOR_NAME + '.apply(this,arguments);' +
'}' + bindCall)(

@@ -187,0 +195,0 @@ mockConstructor);

{
"name": "jest-mock",
"version": "14.3.0-alpha.d13c163e",
"version": "14.3.1-alpha.410cb91a",
"repository": {

@@ -5,0 +5,0 @@ "type": "git",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc