@anzenjs/core
Advanced tools
Comparing version 0.0.3 to 0.0.4-0.0.4-alpha.2.0
@@ -14,3 +14,3 @@ import { IBaseSchema, SchemaType } from './common'; | ||
export declare type BrandDecorator<S extends IBrandSchema> = <T extends ResolveBrand<S> extends T[Key] ? (T[Key] extends ResolveBrand<S> ? {} : never) : never, Key extends keyof T>(target: T, key: Key) => void; | ||
export declare function Brand<S extends SchemaLike, B extends symbol, V extends unknown = true>(childSchema: S, brand: B, value?: V): IBrandSchema<Resolve<S>, B, V> & BrandDecorator<IBrandSchema<Resolve<S>, B, V>>; | ||
export declare function Brand<S extends SchemaLike, B extends symbol, V extends unknown = true>(childSchema: S, brand: B, value?: V): IBrandSchema<Resolve<S>, B, V>; | ||
//# sourceMappingURL=brand.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const common_1 = require("./common"); | ||
const property_1 = require("./property"); | ||
const schema_1 = require("./schema"); | ||
function Brand(childSchema, brand, value = true) { | ||
const schema = { | ||
return { | ||
type: common_1.SchemaType.Brand, | ||
@@ -12,11 +11,5 @@ childSchema: schema_1.resolveSchema(childSchema), | ||
value, | ||
get _() { | ||
return undefined; | ||
}, | ||
}; | ||
return Object.assign((target, key) => { | ||
property_1.Property(schema)(target, key); | ||
}, schema); | ||
} | ||
exports.Brand = Brand; | ||
//# sourceMappingURL=brand.js.map |
@@ -13,3 +13,3 @@ import { IBaseSchema, SchemaType } from './common'; | ||
export declare type DictionaryDecorator<S extends IDictionarySchema> = <T extends ResolveDictionary<S> extends T[Key] ? (T[Key] extends ResolveDictionary<S> ? {} : never) : never, Key extends keyof T>(target: T, key: Key) => void; | ||
export declare function Dictionary<S extends SchemaLike>(childSchema: S): IDictionarySchema<Resolve<S>> & DictionaryDecorator<IDictionarySchema<Resolve<S>>>; | ||
export declare function Dictionary<S extends SchemaLike>(childSchema: S): IDictionarySchema<Resolve<S>>; | ||
//# sourceMappingURL=dictionary.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const common_1 = require("./common"); | ||
const property_1 = require("./property"); | ||
const schema_1 = require("./schema"); | ||
function Dictionary(childSchema) { | ||
const schema = { | ||
return { | ||
type: common_1.SchemaType.Dictionary, | ||
childSchema: schema_1.resolveSchema(childSchema), | ||
get _() { | ||
return undefined; | ||
}, | ||
}; | ||
return Object.assign((target, key) => { | ||
property_1.Property(schema)(target, key); | ||
}, schema); | ||
} | ||
exports.Dictionary = Dictionary; | ||
//# sourceMappingURL=dictionary.js.map |
@@ -9,3 +9,3 @@ import { IBaseSchema, SchemaType } from './common'; | ||
export declare type EnumDecorator<S extends IEnumSchema> = <T extends ResolveEnum<S> extends T[Key] ? (T[Key] extends ResolveEnum<S> ? {} : never) : never, Key extends keyof T>(target: T, key: Key) => void; | ||
export declare function Enum<T extends {} = {}>(values: T): IEnumSchema<T> & EnumDecorator<IEnumSchema<T>>; | ||
export declare function Enum<T extends {} = {}>(values: T): IEnumSchema<T>; | ||
//# sourceMappingURL=enum.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const common_1 = require("./common"); | ||
const property_1 = require("./property"); | ||
function Enum(values) { | ||
const schema = { | ||
return { | ||
type: common_1.SchemaType.Enum, | ||
enumValues: values, | ||
get _() { | ||
return undefined; | ||
}, | ||
}; | ||
return Object.assign((target, key) => { | ||
property_1.Property(schema)(target, key); | ||
}, schema); | ||
} | ||
exports.Enum = Enum; | ||
//# sourceMappingURL=enum.js.map |
@@ -10,3 +10,3 @@ import { IBaseSchema, SchemaType } from './common'; | ||
export declare type ListDecorator<S extends IListSchema> = <T extends ResolveList<S> extends T[Key] ? (T[Key] extends ResolveList<S> ? {} : never) : never, Key extends keyof T>(target: T, key: Key) => void; | ||
export declare function List<S extends SchemaLike>(childSchema: S): IListSchema<Resolve<S>> & ListDecorator<IListSchema<Resolve<S>>>; | ||
export declare function List<S extends SchemaLike>(childSchema: S): IListSchema<Resolve<S>>; | ||
//# sourceMappingURL=list.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const common_1 = require("./common"); | ||
const property_1 = require("./property"); | ||
const schema_1 = require("./schema"); | ||
function List(childSchema) { | ||
const schema = { | ||
return { | ||
type: common_1.SchemaType.List, | ||
@@ -14,7 +13,4 @@ childSchema: schema_1.resolveSchema(childSchema), | ||
}; | ||
return Object.assign((target, key) => { | ||
property_1.Property(schema)(target, key); | ||
}, schema); | ||
} | ||
exports.List = List; | ||
//# sourceMappingURL=list.js.map |
@@ -10,3 +10,3 @@ import { IBaseSchema, SchemaType } from './common'; | ||
export declare type NullableDecorator<S extends INullableSchema> = <T extends ResolveNullable<S> extends T[Key] ? (T[Key] extends ResolveNullable<S> ? {} : never) : never, Key extends keyof T>(target: T, key: Key) => void; | ||
export declare function Nullable<S extends SchemaLike>(childSchema: S): INullableSchema<Resolve<S>> & NullableDecorator<INullableSchema<Resolve<S>>>; | ||
export declare function Nullable<S extends SchemaLike>(childSchema: S): INullableSchema<Resolve<S>>; | ||
//# sourceMappingURL=nullable.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const common_1 = require("./common"); | ||
const property_1 = require("./property"); | ||
const schema_1 = require("./schema"); | ||
function Nullable(childSchema) { | ||
const schema = { | ||
return { | ||
type: common_1.SchemaType.Nullable, | ||
childSchema: schema_1.resolveSchema(childSchema), | ||
get _() { | ||
return undefined; | ||
}, | ||
}; | ||
return Object.assign((target, key) => { | ||
property_1.Property(schema)(target, key); | ||
}, schema); | ||
} | ||
exports.Nullable = Nullable; | ||
//# sourceMappingURL=nullable.js.map |
@@ -10,3 +10,3 @@ import { IBaseSchema, SchemaType } from './common'; | ||
export declare type OptionalDecorator<S extends IOptionalSchema> = <T extends ResolveOptional<S> extends T[Key] ? (T[Key] extends ResolveOptional<S> ? {} : never) : never, Key extends keyof T>(target: T, key: Key) => void; | ||
export declare function Optional<S extends SchemaLike>(childSchema: S): IOptionalSchema<Resolve<S>> & OptionalDecorator<IOptionalSchema<Resolve<S>>>; | ||
export declare function Optional<S extends SchemaLike>(childSchema: S): IOptionalSchema<Resolve<S>>; | ||
//# sourceMappingURL=optional.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const common_1 = require("./common"); | ||
const property_1 = require("./property"); | ||
const schema_1 = require("./schema"); | ||
function Optional(childSchema) { | ||
const schema = { | ||
return { | ||
type: common_1.SchemaType.Optional, | ||
childSchema: schema_1.resolveSchema(childSchema), | ||
get _() { | ||
return undefined; | ||
}, | ||
}; | ||
return Object.assign((target, key) => { | ||
property_1.Property(schema)(target, key); | ||
}, schema); | ||
} | ||
exports.Optional = Optional; | ||
//# sourceMappingURL=optional.js.map |
@@ -12,5 +12,3 @@ import { IBaseSchema, SchemaType } from './common'; | ||
[key in keyof SS]: Resolve<SS[key]>; | ||
}> & TupleDecorator<ITupleSchema<{ | ||
[key in keyof SS]: Resolve<SS[key]>; | ||
}>>; | ||
}>; | ||
//# sourceMappingURL=tuple.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const common_1 = require("./common"); | ||
const property_1 = require("./property"); | ||
const schema_1 = require("./schema"); | ||
function Tuple(...childSchemas) { | ||
const schema = { | ||
return { | ||
type: common_1.SchemaType.Tuple, | ||
childSchemas: childSchemas.map(schema_1.resolveSchema), | ||
get _() { | ||
return undefined; | ||
}, | ||
}; | ||
return Object.assign((target, key) => { | ||
property_1.Property(schema)(target, key); | ||
}, schema); | ||
} | ||
exports.Tuple = Tuple; | ||
//# sourceMappingURL=tuple.js.map |
{ | ||
"name": "@anzenjs/core", | ||
"version": "0.0.3", | ||
"version": "0.0.4-0.0.4-alpha.2.0", | ||
"main": "cjs/src/index.js", | ||
@@ -16,3 +16,3 @@ "types": "cjs/src/index.d.ts", | ||
}, | ||
"gitHead": "d30d062cf97b6d41cbe401b886aca6106111600e" | ||
"gitHead": "2737e87c8a7c778de9c4adc7c705c6aa9cbec6c5" | ||
} |
import { IBaseSchema, SchemaType } from './common' | ||
import { Property } from './property' | ||
import { Resolve, resolveSchema, Schema, SchemaLike } from './schema' | ||
@@ -43,5 +42,4 @@ | ||
value: V = true as V, | ||
): IBrandSchema<Resolve<S>, B, V> & | ||
BrandDecorator<IBrandSchema<Resolve<S>, B, V>> { | ||
const schema: IBrandSchema<Resolve<S>, B, V> = { | ||
): IBrandSchema<Resolve<S>, B, V> { | ||
return { | ||
type: SchemaType.Brand, | ||
@@ -51,9 +49,3 @@ childSchema: resolveSchema(childSchema), | ||
value, | ||
get _(): any { | ||
return undefined | ||
}, | ||
} | ||
return Object.assign((target: any, key: any) => { | ||
Property(schema)(target, key) | ||
}, schema) | ||
} as IBrandSchema<Resolve<S>, B, V> | ||
} |
import { IBaseSchema, SchemaType } from './common' | ||
import { Property } from './property' | ||
import { Resolve, resolveSchema, Schema, SchemaLike } from './schema' | ||
@@ -32,14 +31,7 @@ | ||
childSchema: S, | ||
): IDictionarySchema<Resolve<S>> & | ||
DictionaryDecorator<IDictionarySchema<Resolve<S>>> { | ||
const schema: IDictionarySchema<Resolve<S>> = { | ||
): IDictionarySchema<Resolve<S>> { | ||
return { | ||
type: SchemaType.Dictionary, | ||
childSchema: resolveSchema(childSchema), | ||
get _(): any { | ||
return undefined | ||
}, | ||
} | ||
return Object.assign((target: any, key: any) => { | ||
Property(schema)(target, key) | ||
}, schema) | ||
} as IDictionarySchema<Resolve<S>> | ||
} |
import { IBaseSchema, SchemaType } from './common' | ||
import { Property } from './property' | ||
@@ -26,15 +25,7 @@ export interface IEnumSchema<T extends {} = {}> extends IBaseSchema { | ||
export function Enum<T extends {} = {}>( | ||
values: T, | ||
): IEnumSchema<T> & EnumDecorator<IEnumSchema<T>> { | ||
const schema: IEnumSchema<T> = { | ||
export function Enum<T extends {} = {}>(values: T): IEnumSchema<T> { | ||
return { | ||
type: SchemaType.Enum, | ||
enumValues: values, | ||
get _(): any { | ||
return undefined | ||
}, | ||
} | ||
return Object.assign((target: any, key: any) => { | ||
Property(schema)(target, key) | ||
}, schema) | ||
} as IEnumSchema<T> | ||
} |
import { IBaseSchema, SchemaType } from './common' | ||
import { Property } from './property' | ||
import { Resolve, resolveSchema, Schema, SchemaLike } from './schema' | ||
@@ -27,4 +26,4 @@ | ||
childSchema: S, | ||
): IListSchema<Resolve<S>> & ListDecorator<IListSchema<Resolve<S>>> { | ||
const schema: IListSchema<Resolve<S>> = { | ||
): IListSchema<Resolve<S>> { | ||
return { | ||
type: SchemaType.List, | ||
@@ -35,6 +34,3 @@ childSchema: resolveSchema(childSchema), | ||
}, | ||
} | ||
return Object.assign((target: any, key: any) => { | ||
Property(schema)(target, key) | ||
}, schema) | ||
} as IListSchema<Resolve<S>> | ||
} |
import { IBaseSchema, SchemaType } from './common' | ||
import { Property } from './property' | ||
import { Resolve, resolveSchema, Schema, SchemaLike } from './schema' | ||
@@ -28,14 +27,7 @@ | ||
childSchema: S, | ||
): INullableSchema<Resolve<S>> & | ||
NullableDecorator<INullableSchema<Resolve<S>>> { | ||
const schema: INullableSchema<Resolve<S>> = { | ||
): INullableSchema<Resolve<S>> { | ||
return { | ||
type: SchemaType.Nullable, | ||
childSchema: resolveSchema(childSchema), | ||
get _(): any { | ||
return undefined | ||
}, | ||
} | ||
return Object.assign((target: any, key: any) => { | ||
Property(schema)(target, key) | ||
}, schema) | ||
} as INullableSchema<Resolve<S>> | ||
} |
import { IBaseSchema, SchemaType } from './common' | ||
import { Property } from './property' | ||
import { Resolve, resolveSchema, Schema, SchemaLike } from './schema' | ||
@@ -28,14 +27,7 @@ | ||
childSchema: S, | ||
): IOptionalSchema<Resolve<S>> & | ||
OptionalDecorator<IOptionalSchema<Resolve<S>>> { | ||
const schema: IOptionalSchema<Resolve<S>> = { | ||
): IOptionalSchema<Resolve<S>> { | ||
return { | ||
type: SchemaType.Optional, | ||
childSchema: resolveSchema(childSchema), | ||
get _(): any { | ||
return undefined | ||
}, | ||
} | ||
return Object.assign((target: any, key: any) => { | ||
Property(schema)(target, key) | ||
}, schema) | ||
} as IOptionalSchema<Resolve<S>> | ||
} |
import { IBaseSchema, SchemaType } from './common' | ||
import { Property } from './property' | ||
import { Resolve, resolveSchema, Schema, SchemaLike } from './schema' | ||
@@ -29,14 +28,7 @@ | ||
...childSchemas: SS | ||
): ITupleSchema<{ [key in keyof SS]: Resolve<SS[key]> }> & | ||
TupleDecorator<ITupleSchema<{ [key in keyof SS]: Resolve<SS[key]> }>> { | ||
const schema: ITupleSchema<{ [key in keyof SS]: Resolve<SS[key]> }> = { | ||
): ITupleSchema<{ [key in keyof SS]: Resolve<SS[key]> }> { | ||
return { | ||
type: SchemaType.Tuple, | ||
childSchemas: childSchemas.map(resolveSchema), | ||
get _(): any { | ||
return undefined | ||
}, | ||
} | ||
return Object.assign((target: any, key: any) => { | ||
Property(schema)(target, key) | ||
}, schema) | ||
} as ITupleSchema<{ [key in keyof SS]: Resolve<SS[key]> }> | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
51819
851