tsbuffer-validator
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "tsbuffer-validator", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Validator for TSBuffer values", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -19,2 +19,3 @@ import { TSBufferSchema, TSBufferProto } from 'tsbuffer-schema'; | ||
import { InterfaceReference } from 'tsbuffer-schema/src/InterfaceReference'; | ||
import { TypeReference } from 'tsbuffer-schema/src/TypeReference'; | ||
export interface TSBufferValidatorOptions { | ||
@@ -40,3 +41,3 @@ } | ||
/** 将ReferenceTYpeSchema层层转换为它最终实际引用的类型 */ | ||
private parseReference; | ||
parseReference(schema: TypeReference): Exclude<TSBufferSchema, TypeReference>; | ||
validateBufferType(value: any, schema: BufferTypeSchema): ValidateResult; | ||
@@ -49,3 +50,3 @@ validateIndexedAccessType(value: any, schema: IndexedAccessTypeSchema): ValidateResult; | ||
private _isInterfaceOrReference; | ||
private _isTypeReference; | ||
isTypeReference(schema: TSBufferSchema): schema is TypeReference; | ||
/** | ||
@@ -52,0 +53,0 @@ * 将interface及其引用转换为展平的schema |
@@ -241,3 +241,3 @@ "use strict"; | ||
} | ||
if (this._isTypeReference(parsedSchema)) { | ||
if (this.isTypeReference(parsedSchema)) { | ||
return this.parseReference(parsedSchema); | ||
@@ -288,3 +288,3 @@ } | ||
} | ||
return this._isTypeReference(propType) ? this.parseReference(propType) : propType; | ||
return this.isTypeReference(propType) ? this.parseReference(propType) : propType; | ||
} | ||
@@ -319,3 +319,3 @@ }; | ||
var member = _a[_i]; | ||
var memberType = this._isTypeReference(member.type) ? this.parseReference(member.type) : member.type; | ||
var memberType = this.isTypeReference(member.type) ? this.parseReference(member.type) : member.type; | ||
var vRes = void 0; | ||
@@ -353,3 +353,3 @@ // interface 加入unionFIelds去validate | ||
var memberType = schema.members[i].type; | ||
memberType = this._isTypeReference(memberType) ? this.parseReference(memberType) : memberType; | ||
memberType = this.isTypeReference(memberType) ? this.parseReference(memberType) : memberType; | ||
var vRes = void 0; | ||
@@ -380,3 +380,3 @@ // interface 加入unionFIelds去validate | ||
TSBufferValidator.prototype._isInterfaceOrReference = function (schema) { | ||
if (this._isTypeReference(schema)) { | ||
if (this.isTypeReference(schema)) { | ||
var parsed = this.parseReference(schema); | ||
@@ -393,3 +393,3 @@ return this._isInterfaceOrReference(parsed); | ||
}; | ||
TSBufferValidator.prototype._isTypeReference = function (schema) { | ||
TSBufferValidator.prototype.isTypeReference = function (schema) { | ||
return schema.type === 'Reference' || schema.type === 'IndexedAccess'; | ||
@@ -401,3 +401,3 @@ }; | ||
TSBufferValidator.prototype.getFlatInterfaceSchema = function (schema) { | ||
if (this._isTypeReference(schema)) { | ||
if (this.isTypeReference(schema)) { | ||
var parsed = this.parseReference(schema); | ||
@@ -567,3 +567,3 @@ if (parsed.type !== 'Interface') { | ||
var schema = schemas[i]; | ||
if (this._isTypeReference(schema)) { | ||
if (this.isTypeReference(schema)) { | ||
schema = this.parseReference(schema); | ||
@@ -570,0 +570,0 @@ } |
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
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
129360
2140