@produck/mold
Advanced tools
Comparing version 0.1.1 to 0.2.0
{ | ||
"name": "@produck/mold", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "For helping to create a final options from a defined specification.", | ||
@@ -13,3 +13,2 @@ "keywords": [ | ||
"license": "MIT", | ||
"type": "module", | ||
"types": "types/index.d.js", | ||
@@ -25,2 +24,4 @@ "files": [ | ||
}, | ||
"main": "dist/mold.cjs", | ||
"type": "module", | ||
"exports": { | ||
@@ -30,3 +31,2 @@ "import": "./src/index.mjs", | ||
}, | ||
"main": "index.js", | ||
"repository": { | ||
@@ -52,3 +52,3 @@ "type": "git", | ||
}, | ||
"gitHead": "b84c1ada27a2db03beb181d38c38eb38d9c7a1e0" | ||
"gitHead": "81c6ece2bb1e5b97b1a2cda9389c6214f807368c" | ||
} |
@@ -5,3 +5,3 @@ # @produck/mold | ||
[![npm (scoped)](https://img.shields.io/npm/v/@produck/mold)](https://www.npmjs.com/package/@produck/mold) | ||
[![npm](https://img.shields.io/npm/dw/@produck/koa-forker)](https://www.npmjs.com/package/@produck/mold) | ||
[![npm](https://img.shields.io/npm/dw/@produck/mold)](https://www.npmjs.com/package/@produck/mold) | ||
[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg?style=flat-square)](https://lerna.js.org/) | ||
@@ -8,0 +8,0 @@ [![NPM](https://img.shields.io/npm/l/@produck/mold)](https://opensource.org/licenses/MIT) |
@@ -5,13 +5,33 @@ import { Schema } from './schema'; | ||
interface ArrayOptionsObject< | ||
CustomSchema extends Schema = Schema | ||
> { | ||
items?: CustomSchema; | ||
minLength?: number; | ||
maxLength?: number; | ||
key?: (item?: any, index?: number) => any; | ||
} | ||
type ArrayOptions< | ||
CustomSchema extends Schema = Schema | ||
> = ArrayOptionsObject<CustomSchema> | Schema; | ||
type ArrayItemSchemaType< | ||
CustomSchemaOptions extends ArrayOptions | ||
> = CustomSchemaOptions extends ArrayOptionsObject<infer S> | ||
? ReturnType<S> : CustomSchemaOptions extends Schema | ||
? ReturnType<CustomSchemaOptions> | ||
: never; | ||
interface ArraySchema { | ||
<CustomSchema extends Schema = Schema<any>>( | ||
itemSchema: CustomSchema, | ||
<CustomArrayOptions extends ArrayOptions = {}>( | ||
options: CustomArrayOptions, | ||
expected?: string, | ||
DefaultValue?: DefaultValue | ||
): Schema<Array<ReturnType<CustomSchema>>>; | ||
): Schema<Array<ArrayItemSchemaType<CustomArrayOptions>>>; | ||
<CustomSchema extends Schema = Schema<any>>( | ||
itemSchema: CustomSchema, | ||
<CustomArrayOptions extends ArrayOptions = {}>( | ||
options: CustomArrayOptions, | ||
DefaultValue: DefaultValue | ||
): Schema<Array<ReturnType<CustomSchema>>>; | ||
): Schema<Array<ArrayItemSchemaType<CustomArrayOptions>>>; | ||
} | ||
@@ -18,0 +38,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
56841
1578