Socket
Socket
Sign inDemoInstall

schema-typed

Package Overview
Dependencies
0
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.5.0 to 1.5.1

4

CHANGELOG.md

@@ -0,1 +1,5 @@

# 1.5.1
- Update the typescript definition of `addRule`
# 1.5.0

@@ -2,0 +6,0 @@

4

es/ArrayType.js

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

var ArrayType =
/*#__PURE__*/
function (_Type) {
var ArrayType = /*#__PURE__*/function (_Type) {
_inheritsLoose(ArrayType, _Type);

@@ -23,0 +21,0 @@

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

var BooleanType =
/*#__PURE__*/
function (_Type) {
var BooleanType = /*#__PURE__*/function (_Type) {
_inheritsLoose(BooleanType, _Type);

@@ -23,0 +21,0 @@

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

var DateType =
/*#__PURE__*/
function (_Type) {
var DateType = /*#__PURE__*/function (_Type) {
_inheritsLoose(DateType, _Type);

@@ -23,0 +21,0 @@

@@ -22,5 +22,3 @@ "use strict";

var NumberType =
/*#__PURE__*/
function (_Type) {
var NumberType = /*#__PURE__*/function (_Type) {
_inheritsLoose(NumberType, _Type);

@@ -27,0 +25,0 @@

@@ -14,3 +14,3 @@ "use strict";

function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

@@ -21,5 +21,3 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

var ObjectType =
/*#__PURE__*/
function (_Type) {
var ObjectType = /*#__PURE__*/function (_Type) {
_inheritsLoose(ObjectType, _Type);

@@ -26,0 +24,0 @@

@@ -12,5 +12,3 @@ "use strict";

var Schema =
/*#__PURE__*/
function () {
var Schema = /*#__PURE__*/function () {
function Schema(schema) {

@@ -17,0 +15,0 @@ this.schema = schema;

@@ -14,10 +14,14 @@ "use strict";

function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
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 _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
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 _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

@@ -28,5 +32,3 @@

/* eslint-disable */
var StringType =
/*#__PURE__*/
function (_Type) {
var StringType = /*#__PURE__*/function (_Type) {
_inheritsLoose(StringType, _Type);

@@ -33,0 +35,0 @@

@@ -8,3 +8,3 @@ "use strict";

function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

@@ -89,5 +89,3 @@ function isEmpty(value) {

var Type =
/*#__PURE__*/
function () {
var Type = /*#__PURE__*/function () {
function Type(name) {

@@ -94,0 +92,0 @@ this.name = name;

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

var ArrayType =
/*#__PURE__*/
function (_Type) {
var ArrayType = /*#__PURE__*/function (_Type) {
_inheritsLoose(ArrayType, _Type);

@@ -23,0 +21,0 @@

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

var BooleanType =
/*#__PURE__*/
function (_Type) {
var BooleanType = /*#__PURE__*/function (_Type) {
_inheritsLoose(BooleanType, _Type);

@@ -23,0 +21,0 @@

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

var DateType =
/*#__PURE__*/
function (_Type) {
var DateType = /*#__PURE__*/function (_Type) {
_inheritsLoose(DateType, _Type);

@@ -23,0 +21,0 @@

@@ -22,5 +22,3 @@ "use strict";

var NumberType =
/*#__PURE__*/
function (_Type) {
var NumberType = /*#__PURE__*/function (_Type) {
_inheritsLoose(NumberType, _Type);

@@ -27,0 +25,0 @@

@@ -14,3 +14,3 @@ "use strict";

function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

@@ -21,5 +21,3 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

var ObjectType =
/*#__PURE__*/
function (_Type) {
var ObjectType = /*#__PURE__*/function (_Type) {
_inheritsLoose(ObjectType, _Type);

@@ -26,0 +24,0 @@

@@ -12,5 +12,3 @@ "use strict";

var Schema =
/*#__PURE__*/
function () {
var Schema = /*#__PURE__*/function () {
function Schema(schema) {

@@ -17,0 +15,0 @@ this.schema = schema;

@@ -14,10 +14,14 @@ "use strict";

function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
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 _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
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 _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

@@ -28,5 +32,3 @@

/* eslint-disable */
var StringType =
/*#__PURE__*/
function (_Type) {
var StringType = /*#__PURE__*/function (_Type) {
_inheritsLoose(StringType, _Type);

@@ -33,0 +35,0 @@

@@ -8,3 +8,3 @@ "use strict";

function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

@@ -89,5 +89,3 @@ function isEmpty(value) {

var Type =
/*#__PURE__*/
function () {
var Type = /*#__PURE__*/function () {
function Type(name) {

@@ -94,0 +92,0 @@ this.name = name;

{
"name": "schema-typed",
"version": "1.5.0",
"version": "1.5.1",
"description": "Schema for data modeling & validation",

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

interface CheckResult<ErrorMsgType = string> {
hasError: boolean;
errorMessage: ErrorMsgType;
hasError: boolean;
errorMessage: ErrorMsgType;
}
declare class Type<ValueType = any, DataType = any, ErrorMsgType = string> {
readonly name: string;
constructor(name: string);
check: (value: ValueType, data: any) => CheckResult<ErrorMsgType>;
addRule: (
onValid: (value: ValueType, data: DataType) =>
CheckResult<ErrorMsgType> | boolean | void | undefined | Promise<boolean> | Promise<CheckResult<ErrorMsgType>> | Promise<void>,
errorMessage?: ErrorMsgType
) => this;
isRequired: (errorMessage?: ErrorMsgType) => this;
isRequiredOrEmpty: (errorMessage?: ErrorMsgType) => this;
readonly name: string;
constructor(name: string);
check: (value: ValueType, data: any) => CheckResult<ErrorMsgType>;
addRule: (
onValid: (
value: ValueType,
data: DataType
) =>
| CheckResult<ErrorMsgType>
| boolean
| void
| undefined
| Promise<boolean>
| Promise<CheckResult<ErrorMsgType>>
| Promise<void>,
errorMessage?: ErrorMsgType,
priority?: boolean
) => this;
isRequired: (errorMessage?: ErrorMsgType) => this;
isRequiredOrEmpty: (errorMessage?: ErrorMsgType) => this;
}
export { CheckResult, Type };
export { CheckResult, Type };
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc