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

oc-vlad

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oc-vlad - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

dist/types.d.ts

3

dist/types.js

@@ -1,1 +0,2 @@

"use strict";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.all = all;
var _deepmerge = _interopRequireDefault(require("deepmerge"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
// @ts-nocheck
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var deepmerge_1 = __importDefault(require("deepmerge"));
function all() {
for (var _len = arguments.length, validators = new Array(_len), _key = 0; _key < _len; _key++) {
validators[_key] = arguments[_key];
}
return function allValidator(subject, context) {
return validators.map(function (it) {
return it(subject, context);
}).reduce(function (acc, cur) {
if (cur === undefined) return acc;
return (0, _deepmerge["default"])(acc, cur);
}, undefined);
};
}
var validators = [];
for (var _i = 0; _i < arguments.length; _i++) {
validators[_i] = arguments[_i];
}
return function allValidator(subject, context) {
return validators
.map(function (it) { return it(subject, context); })
.reduce(function (acc, cur) {
if (cur === undefined)
return acc;
return deepmerge_1.default(acc, cur);
}, undefined);
};
}
exports.all = all;
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "__esModule", { value: true });
function allItems(validator) {
return function allItemsValidator(array, context) {
if (array === undefined)
return undefined;
var errorEntries = array
.map(function (value, index) { return [index, validator(value, context)]; })
.filter(function (_a) {
var _ = _a[0], errors = _a[1];
return errors !== undefined;
});
if (errorEntries.length === 0)
return undefined;
return Object.fromEntries(errorEntries);
};
}
exports.allItems = allItems;
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function allItems(validator) {
return function allItemsValidator(array, context) {
if (array === undefined) return undefined;
var errorEntries = array.map(function (value, index) {
return [index, validator(value, context)];
}).filter(function (_ref) {
var _ref2 = _slicedToArray(_ref, 2),
_ = _ref2[0],
errors = _ref2[1];
return errors !== undefined;
});
if (errorEntries.length === 0) return undefined;
return Object.fromEntries(errorEntries);
};
}
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "__esModule", { value: true });
function is(expected, message) {
return function isValidator(subject) {
if (subject === expected)
return undefined;
return [message];
};
}
exports.is = is;
function is(expected, message) {
return function isValidator(subject) {
if (subject === expected) return undefined;
return [message];
};
}
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.maxItems = maxItems;
Object.defineProperty(exports, "__esModule", { value: true });
function maxItems(length, message) {
return function minItemsValidator(value) {
if (value === undefined) return undefined;
var subjectLength = value.length;
if (subjectLength <= length) return undefined;
return {
_self: [message]
return function minItemsValidator(value) {
if (value === undefined)
return undefined;
var subjectLength = value.length;
if (subjectLength <= length)
return undefined;
return { _self: [message] };
};
};
}
}
exports.maxItems = maxItems;
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "__esModule", { value: true });
function maxLength(length, message) {
return function maxLengthValidator(value) {
if (value === undefined)
return undefined;
var subjectLength = value.length;
if (subjectLength <= length)
return undefined;
return [message];
};
}
exports.maxLength = maxLength;
function maxLength(length, message) {
return function maxLengthValidator(value) {
if (value === undefined) return undefined;
var subjectLength = value.length;
if (subjectLength <= length) return undefined;
return [message];
};
}
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "__esModule", { value: true });
function min(minValue, message) {
return function minValidator(subject) {
if (subject === undefined)
return undefined;
if (subject >= minValue)
return undefined;
return [message];
};
}
exports.min = min;
function min(minValue, message) {
return function minValidator(subject) {
if (subject === undefined) return undefined;
if (subject >= minValue) return undefined;
return [message];
};
}
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.minItems = minItems;
Object.defineProperty(exports, "__esModule", { value: true });
function minItems(length, message) {
return function minItemsValidator(value) {
if (value === undefined) return undefined;
var subjectLength = value.length;
if (subjectLength >= length) return undefined;
return {
_self: [message]
return function minItemsValidator(value) {
if (value === undefined)
return undefined;
var subjectLength = value.length;
if (subjectLength >= length)
return undefined;
return { _self: [message] };
};
};
}
}
exports.minItems = minItems;
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "__esModule", { value: true });
function minLength(length, message) {
return function minLengthValidator(value) {
if (value === undefined)
return undefined;
var subjectLength = value.length;
if (subjectLength >= length)
return undefined;
return [message];
};
}
exports.minLength = minLength;
function minLength(length, message) {
return function minLengthValidator(value) {
if (value === undefined) return undefined;
var subjectLength = value.length;
if (subjectLength >= length) return undefined;
return [message];
};
}
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "__esModule", { value: true });
function nullish(message) {
return function nullishValidator(subject) {
if (subject === undefined || subject === null)
return undefined;
return [message];
};
}
exports.nullish = nullish;
function nullish(message) {
return function nullishValidator(subject) {
if (subject === undefined || subject === null) return undefined;
return [message];
};
}
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "__esModule", { value: true });
function properties(validatorMap) {
return function propertiesValidator(subject, context) {
if (subject === undefined)
return undefined;
var errorEntries = Object
.keys(validatorMap)
.map(function (key) { return [key, validatorMap[key](subject[key], context)]; })
.filter(function (_a) {
var _ = _a[0], errors = _a[1];
return errors !== undefined;
});
if (errorEntries.length === 0)
return undefined;
return Object.fromEntries(errorEntries);
};
}
exports.properties = properties;
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function properties(validatorMap) {
return function propertiesValidator(subject, context) {
if (subject === undefined) return undefined;
var errorEntries = Object.keys(validatorMap).map(function (key) {
return [key, validatorMap[key](subject[key], context)];
}).filter(function (_ref) {
var _ref2 = _slicedToArray(_ref, 2),
_ = _ref2[0],
errors = _ref2[1];
return errors !== undefined;
});
if (errorEntries.length === 0) return undefined;
return Object.fromEntries(errorEntries);
};
}
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.requiredObject = requiredObject;
Object.defineProperty(exports, "__esModule", { value: true });
function requiredObject(message) {
return function requiredValidator(value) {
if (value === undefined || value === null) return {
_self: [message]
return function requiredValidator(value) {
if (value === undefined || value === null)
return { _self: [message] };
return undefined;
};
return undefined;
};
}
}
exports.requiredObject = requiredObject;
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "__esModule", { value: true });
function requiredPrimitive(message) {
return function requiredValidator(value) {
if (value === undefined || value === null)
return [message];
return undefined;
};
}
exports.requiredPrimitive = requiredPrimitive;
function requiredPrimitive(message) {
return function requiredValidator(value) {
if (value === undefined || value === null) return [message];
return undefined;
};
}
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _allItems = require("./validators/allItems");
Object.keys(_allItems).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _allItems[key];
}
});
});
var _maxItems = require("./validators/maxItems");
Object.keys(_maxItems).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _maxItems[key];
}
});
});
var _maxLength = require("./validators/maxLength");
Object.keys(_maxLength).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _maxLength[key];
}
});
});
var _minItems = require("./validators/minItems");
Object.keys(_minItems).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _minItems[key];
}
});
});
var _minLength = require("./validators/minLength");
Object.keys(_minLength).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _minLength[key];
}
});
});
var _properties = require("./validators/properties");
Object.keys(_properties).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _properties[key];
}
});
});
var _requiredObject = require("./validators/requiredObject");
Object.keys(_requiredObject).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _requiredObject[key];
}
});
});
var _requiredPrimitive = require("./validators/requiredPrimitive");
Object.keys(_requiredPrimitive).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _requiredPrimitive[key];
}
});
});
var _is = require("./validators/is");
Object.keys(_is).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _is[key];
}
});
});
var _nullish = require("./validators/nullish");
Object.keys(_nullish).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _nullish[key];
}
});
});
var _types = require("./types");
Object.keys(_types).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _types[key];
}
});
});
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./validators/allItems"));
__export(require("./validators/maxItems"));
__export(require("./validators/maxLength"));
__export(require("./validators/minItems"));
__export(require("./validators/minLength"));
__export(require("./validators/properties"));
__export(require("./validators/requiredObject"));
__export(require("./validators/requiredPrimitive"));
__export(require("./validators/is"));
__export(require("./validators/nullish"));
{
"name": "oc-vlad",
"version": "0.2.1",
"version": "0.2.2",
"description": "",

@@ -10,3 +10,3 @@ "main": "dist/vlad.js",

"scripts": {
"build": "tsc && babel ./src -d dist --extensions .ts",
"build": "tsc",
"test": "tsc && ava"

@@ -13,0 +13,0 @@ },

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