Comparing version 0.1.0-canary-1 to 0.2.0
@@ -1,3 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=types.js.map | ||
"use strict"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
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 (_a) { | ||
var _ = _a[0], errors = _a[1]; | ||
return errors !== undefined; | ||
}); | ||
if (errorEntries.length === 0) | ||
return undefined; | ||
return Object.fromEntries(errorEntries); | ||
}; | ||
} | ||
exports.allItems = allItems; | ||
//# sourceMappingURL=allItems.js.map | ||
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 | ||
}); | ||
exports.is = is; | ||
function is(expected, message) { | ||
return function isValidator(subject) { | ||
if (subject === expected) | ||
return undefined; | ||
return [message]; | ||
}; | ||
} | ||
exports.is = is; | ||
//# sourceMappingURL=is.js.map | ||
return function isValidator(subject) { | ||
if (subject === expected) return undefined; | ||
return [message]; | ||
}; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.maxItems = maxItems; | ||
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; | ||
//# sourceMappingURL=maxItems.js.map | ||
}; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
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]; | ||
}; | ||
} | ||
exports.maxLength = maxLength; | ||
//# sourceMappingURL=maxLength.js.map | ||
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 | ||
}); | ||
exports.minItems = minItems; | ||
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; | ||
//# sourceMappingURL=minItems.js.map | ||
}; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
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]; | ||
}; | ||
} | ||
exports.minLength = minLength; | ||
//# sourceMappingURL=minLength.js.map | ||
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 | ||
}); | ||
exports.nullish = nullish; | ||
function nullish(message) { | ||
return function nullishValidator(subject) { | ||
if (subject === undefined || subject === null) | ||
return undefined; | ||
return [message]; | ||
}; | ||
} | ||
exports.nullish = nullish; | ||
//# sourceMappingURL=nullish.js.map | ||
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 | ||
}); | ||
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 (_a) { | ||
var _ = _a[0], errors = _a[1]; | ||
return errors !== undefined; | ||
}); | ||
if (errorEntries.length === 0) | ||
return undefined; | ||
return Object.fromEntries(errorEntries); | ||
}; | ||
} | ||
exports.properties = properties; | ||
//# sourceMappingURL=properties.js.map | ||
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 }); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.required = required; | ||
function required(message) { | ||
return function requiredValidator(value) { | ||
if (typeof value === 'number' || typeof value === 'boolean') | ||
return undefined; | ||
if (value) | ||
return undefined; | ||
return [message]; | ||
}; | ||
} | ||
exports.required = required; | ||
//# sourceMappingURL=required.js.map | ||
return function requiredValidator(value) { | ||
if (typeof value === 'number' || typeof value === 'boolean') return undefined; | ||
if (value) return undefined; | ||
return [message]; | ||
}; | ||
} |
150
dist/vlad.js
"use strict"; | ||
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/required")); | ||
__export(require("./validators/is")); | ||
__export(require("./validators/nullish")); | ||
//# sourceMappingURL=vlad.js.map | ||
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]; | ||
} | ||
}); | ||
}); |
{ | ||
"name": "oc-vlad", | ||
"version": "0.1.0-canary-1", | ||
"version": "0.2.0", | ||
"description": "", | ||
"main": "dist/vlad.js", | ||
"files": [ | ||
"dist", | ||
"src" | ||
], | ||
"scripts": { | ||
"build": "tsc", | ||
"test": "tsc --noEmit && ava" | ||
"build": "tsc && babel ./src -d dist --extensions .ts", | ||
"test": "tsc && ava" | ||
}, | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@types/node": "^13.1.1", | ||
"@ava/babel": "^0.2.0", | ||
"@babel/cli": "^7.8.4", | ||
"@babel/core": "^7.9.0", | ||
"@babel/preset-env": "^7.9.5", | ||
"@babel/preset-typescript": "^7.9.0", | ||
"ava": "^2.4.0", | ||
@@ -21,4 +21,4 @@ "eslint": "^6.8.0", | ||
"esm": "^3.2.25", | ||
"ts-node": "^8.5.4", | ||
"typescript": "^3.7.4" | ||
"ts-node": "^8.8.2", | ||
"typescript": "^3.8.3" | ||
}, | ||
@@ -37,4 +37,12 @@ "ava": { | ||
] | ||
}, | ||
"babel": { | ||
"presets": [ | ||
"@babel/env", | ||
"@babel/preset-typescript" | ||
] | ||
}, | ||
"dependencies": { | ||
"deepmerge": "^4.2.2" | ||
} | ||
} | ||
@@ -7,4 +7,7 @@ export * from './validators/allItems' | ||
export * from './validators/properties' | ||
export * from './validators/required' | ||
export * from './validators/requiredObject' | ||
export * from './validators/requiredPrimitive' | ||
export * from './validators/is' | ||
export * from './validators/nullish' | ||
export * from './types' |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37370
706
1
11
42
1
+ Addeddeepmerge@^4.2.2
+ Addeddeepmerge@4.3.1(transitive)