Socket
Socket
Sign inDemoInstall

rjutils-collection

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rjutils-collection - npm Package Compare versions

Comparing version 1.7.0 to 1.7.1

2

lib/cjs/pckg.json
{
"name": "rjutils-collection",
"version": "1.7.0",
"version": "1.7.1",
"description": "Easy and Lightweight Utilities",

@@ -5,0 +5,0 @@ "module": "lib/esm/index.js",

@@ -41,13 +41,13 @@ "use strict";

}
function zValidate() {
function zValidate(validations = []) {
return function(target, context) {
const fn = arguments[2].value;
(0, import__.as)(arguments[2]).value = function(...args) {
var _a;
var _a, _b, _c;
const finalArgs = [];
const zTypes = (0, import__.as)((_a = Object.getOwnPropertyDescriptor(target, zodValidateSymbol)) == null ? void 0 : _a.value).reverse();
const zTypes = (0, import__.as)((_c = (_b = (_a = Object.getOwnPropertyDescriptor(target, zodValidateSymbol)) == null ? void 0 : _a.value) == null ? void 0 : _b.reverse()) != null ? _c : validations.map((v, i) => ({ param: i, type: typeof v === "function" ? v(import_zod.z) : v })));
for (let i = 0; i < zTypes.length; i++) {
const infos = zTypes[i].type.safeParse(args[zTypes[i].param]);
if (!infos.success)
throw new Error(`${context}(${"!, ".repeat(i)}X${", ?".repeat(zTypes.length - 1 - i)}) | ${infos.error.errors[0].message}`);
throw new Error(`${context}(${"X, ".repeat(i)}!${", x".repeat(zTypes.length - 1 - i)}) | ${infos.error.errors[0].message}`);
else

@@ -54,0 +54,0 @@ finalArgs.push(infos.data);

{
"name": "rjutils-collection",
"version": "1.7.0",
"version": "1.7.1",
"description": "Easy and Lightweight Utilities",

@@ -5,0 +5,0 @@ "module": "lib/esm/index.js",

@@ -17,13 +17,13 @@ import { as } from "..";

}
function zValidate() {
function zValidate(validations = []) {
return function(target, context) {
const fn = arguments[2].value;
as(arguments[2]).value = function(...args) {
var _a;
var _a, _b, _c;
const finalArgs = [];
const zTypes = as((_a = Object.getOwnPropertyDescriptor(target, zodValidateSymbol)) == null ? void 0 : _a.value).reverse();
const zTypes = as((_c = (_b = (_a = Object.getOwnPropertyDescriptor(target, zodValidateSymbol)) == null ? void 0 : _a.value) == null ? void 0 : _b.reverse()) != null ? _c : validations.map((v, i) => ({ param: i, type: typeof v === "function" ? v(z) : v })));
for (let i = 0; i < zTypes.length; i++) {
const infos = zTypes[i].type.safeParse(args[zTypes[i].param]);
if (!infos.success)
throw new Error(`${context}(${"!, ".repeat(i)}X${", ?".repeat(zTypes.length - 1 - i)}) | ${infos.error.errors[0].message}`);
throw new Error(`${context}(${"X, ".repeat(i)}!${", x".repeat(zTypes.length - 1 - i)}) | ${infos.error.errors[0].message}`);
else

@@ -30,0 +30,0 @@ finalArgs.push(infos.data);

@@ -35,5 +35,14 @@ import { z } from "zod";

* }
*
* // or
*
* class MyClass {
* ‍@zValidate([ (z) => z.number() ])
* public getAsHex(‍num: number): string {
* return num.toString(16)
* }
* }
* ```
* @since 1.7.0
*/ export declare function zValidate(): <This, Args extends any[], Return>(target: (this: This, ...args: Args) => Return, context: ClassMethodDecoratorContext<This, (this: This, ...args: Args) => Return>) => void;
*/ export declare function zValidate(validations?: (z.ZodType | ((z: Zod['z']) => z.ZodType))[]): <This, Args extends any[], Return>(target: (this: This, ...args: Args) => Return, context: ClassMethodDecoratorContext<This, (this: This, ...args: Args) => Return>) => void;
export {};
{
"name": "rjutils-collection",
"version": "1.7.0",
"version": "1.7.1",
"description": "Easy and Lightweight Utilities",

@@ -5,0 +5,0 @@ "module": "lib/esm/index.js",

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