New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

simple-validators

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-validators - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

dist/types/index.d.ts.map

1

dist/cjs/index.js

@@ -28,2 +28,1 @@ "use strict";

Object.defineProperty(exports, "filterKeys", { enumerable: true, get: function () { return validators_1.filterKeys; } });
//# sourceMappingURL=index.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=types.js.map

@@ -33,2 +33,1 @@ "use strict";

exports.formatDate = formatDate;
//# sourceMappingURL=utils.js.map

@@ -235,7 +235,10 @@ "use strict";

function validateKeys(input, keys, opts) {
var _a;
const value = {};
let required = keys.required || [];
const aliasKeys = Object.keys((_a = keys.alias) !== null && _a !== void 0 ? _a : {});
const optional = keys.optional || [];
const ignored = [];
Object.keys(input).forEach((k) => {
var _a;
if (required.includes(k) || optional.includes(k)) {

@@ -245,2 +248,12 @@ value[k] = input[k];

}
else if (aliasKeys.includes(k)) {
const normalized = (_a = keys.alias) === null || _a === void 0 ? void 0 : _a[k];
if (input[normalized] === undefined) {
value[normalized] = input[k];
required = required.filter((val) => val !== normalized);
}
else {
validationWarning(`both "${normalized}" and "${k}" were provided, "${k}" was ignored.`, opts);
}
}
else {

@@ -304,2 +317,1 @@ ignored.push(k);

exports.filterKeys = filterKeys;
//# sourceMappingURL=validators.js.map
export { getDate, formatDate } from './utils';
export { defined, locationSuffix, incrementOptions, validationError, validationWarning, validateBoolean, validateString, validateNumber, validateUrl, validateSubdomain, validateEmail, validateChoice, validateEnum, validateDate, validateObject, validateKeys, validateObjectKeys, validateList, fillMissingKeys, filterKeys, } from './validators';
//# sourceMappingURL=index.js.map
export {};
//# sourceMappingURL=types.js.map

@@ -28,2 +28,1 @@ export function getDate(object) {

}
//# sourceMappingURL=utils.js.map

@@ -217,7 +217,10 @@ import { formatDate } from './utils';

export function validateKeys(input, keys, opts) {
var _a;
const value = {};
let required = keys.required || [];
const aliasKeys = Object.keys((_a = keys.alias) !== null && _a !== void 0 ? _a : {});
const optional = keys.optional || [];
const ignored = [];
Object.keys(input).forEach((k) => {
var _a;
if (required.includes(k) || optional.includes(k)) {

@@ -227,2 +230,12 @@ value[k] = input[k];

}
else if (aliasKeys.includes(k)) {
const normalized = (_a = keys.alias) === null || _a === void 0 ? void 0 : _a[k];
if (input[normalized] === undefined) {
value[normalized] = input[k];
required = required.filter((val) => val !== normalized);
}
else {
validationWarning(`both "${normalized}" and "${k}" were provided, "${k}" was ignored.`, opts);
}
}
else {

@@ -281,2 +294,1 @@ ignored.push(k);

}
//# sourceMappingURL=validators.js.map
export type { ValidationOptions, KeyOptions } from './types';
export { getDate, formatDate } from './utils';
export { defined, locationSuffix, incrementOptions, validationError, validationWarning, validateBoolean, validateString, validateNumber, validateUrl, validateSubdomain, validateEmail, validateChoice, validateEnum, validateDate, validateObject, validateKeys, validateObjectKeys, validateList, fillMissingKeys, filterKeys, } from './validators';
//# sourceMappingURL=index.d.ts.map

@@ -23,1 +23,2 @@ declare type message = {

export {};
//# sourceMappingURL=types.d.ts.map

@@ -7,1 +7,2 @@ export declare function getDate(object: undefined | Date | string | {

}): string;
//# sourceMappingURL=utils.d.ts.map

@@ -99,2 +99,3 @@ import type { KeyOptions, ValidationOptions } from './types';

optional?: string[];
alias?: Record<string, string>;
}, opts: KeyOptions): Record<string, any> | undefined;

@@ -109,2 +110,3 @@ /**

optional?: string[];
alias?: Record<string, string>;
}, opts: KeyOptions): Record<string, any> | undefined;

@@ -120,1 +122,2 @@ /**

export declare function filterKeys(value: Record<string, any>, keys: string[]): Record<string, any>;
//# sourceMappingURL=validators.d.ts.map
{
"name": "simple-validators",
"version": "0.0.2",
"version": "0.0.3",
"license": "MIT",

@@ -36,4 +36,3 @@ "description": "Schema validation functions and error reporting framework",

"build:cjs": "tsc --project ./tsconfig.json --module commonjs --outDir dist/cjs",
"declarations": "tsc --project ./tsconfig.json --declaration --emitDeclarationOnly --outDir dist/types",
"prepublishOnly": "npm run build",
"declarations": "tsc --project ./tsconfig.json --declaration --emitDeclarationOnly --declarationMap --outDir dist/types",
"build": "npm-run-all -l clean -p build:cjs build:esm declarations"

@@ -47,3 +46,3 @@ },

"eslint": "^8.21.0",
"eslint-config-curvenote": "*",
"eslint-config-curvenote": "latest",
"jest": "28.1.3",

@@ -50,0 +49,0 @@ "jest-extended": "^3.0.1",

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