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

@anatine/zod-mock

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@anatine/zod-mock - npm Package Compare versions

Comparing version 3.0.3 to 3.0.4

4

package.json
{
"name": "@anatine/zod-mock",
"version": "3.0.3",
"version": "3.0.4",
"description": "Zod auto-mock object generator using Faker at @faker-js/faker",

@@ -24,3 +24,3 @@ "main": "src/index.js",

"peerDependencies": {
"@faker-js/faker": "^6.0.0-alpha.6"
"@faker-js/faker": "^6.0.0-alpha.7"
},

@@ -27,0 +27,0 @@ "typings": "./src/index.d.ts",

@@ -10,10 +10,10 @@ import { z, ZodTypeAny } from 'zod';

/**
* This is a mapping of field name to mock generator function.
* This mapping can be used to provide backup mock
* functions for Zod types not yet implemented in {@link WorkerKeys}.
* The functions in this map will only be used if this library
* is unable to find an appropriate mocking function to use.
*/
backupMocks?: Record<string, (() => any | undefined)>;
* This is a mapping of field name to mock generator function.
* This mapping can be used to provide backup mock
* functions for Zod types not yet implemented in {@link WorkerKeys}.
* The functions in this map will only be used if this library
* is unable to find an appropriate mocking function to use.
*/
backupMocks?: Record<string, () => any | undefined>;
}
export declare function generateMock<T extends ZodTypeAny>(zodRef: T, options?: GenerateMockOptions): z.infer<typeof zodRef>;

@@ -18,3 +18,21 @@ "use strict";

fnName =
lower === lowerCaseKeyName || lower === withoutDashesUnderscores ? keyName : undefined;
lower === lowerCaseKeyName || lower === withoutDashesUnderscores
? keyName
: undefined;
// Skipping depreciated items
const depreciated = {
random: [
'image',
'number',
'float',
'uuid',
'boolean',
'hexaDecimal',
],
};
if (Object.keys(depreciated).find((key) => key === sectionKey
? depreciated[key].find((fn) => fn === fnName)
: false)) {
return undefined;
}
if (fnName) {

@@ -27,6 +45,6 @@ const fn = (_a = faker_1.faker[sectionKey]) === null || _a === void 0 ? void 0 : _a[fnName];

const mock = fn();
return typeof mock === 'string'
|| typeof mock === 'number'
|| typeof mock === 'boolean'
|| mock instanceof Date
return typeof mock === 'string' ||
typeof mock === 'number' ||
typeof mock === 'boolean' ||
mock instanceof Date
? fnName

@@ -33,0 +51,0 @@ : undefined;

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