Skip to content

Commit

Permalink
feat(bindings): rename to add prefix of prop
Browse files Browse the repository at this point in the history
  • Loading branch information
TomokiMiyauci committed Jun 2, 2023
1 parent db65b8e commit ec6a956
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
12 changes: 6 additions & 6 deletions bindings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -471,28 +471,28 @@ export function between<In>(min: In, max: In) {
* @example
* ```ts
* import {
* key,
* propKey,
* type Validator,
* } from "https://deno.land/x/abstruct@$VERSION/mod.ts";
* declare const validator: Validator<string>;
* const keyValidator = key(validator);
* const keyValidator = propKey(validator);
* ```
*/
export const key = /* @__PURE__ */ createInst(PropertyKeyValidator);
export const propKey = /* @__PURE__ */ createInst(PropertyKeyValidator);

/** Factory for property value validator.
*
* @example
* ```ts
* import {
* type Validator,
* value,
* propValue,
* } from "https://deno.land/x/abstruct@$VERSION/mod.ts";
* declare const validator: Validator;
* const valueValidator = value(validator);
* const valueValidator = propValue(validator);
* ```
*/
export const value = /* @__PURE__ */ createInst(PropertyValueValidator);
export const propValue = /* @__PURE__ */ createInst(PropertyValueValidator);

// Array
/** Factory for fixed array validator. It checks each item passes each {@link Validator}.
Expand Down
20 changes: 10 additions & 10 deletions docs/binding.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ Objects implementing this interface also come with default messages.
| [optional](#optional) | Closure | OptionalValidator | |
| [enumerator](#enumerator) | Closure | EnumValidator ||
| [nullish](#nullish) | Object | NullishValidator ||
| [key](#key) | Closure | PropertyKeyValidator | |
| [value](#value) | Closure | PropertyValueValidator | |
| [propKey](#propkey) | Closure | PropertyKeyValidator | |
| [propValue](#propvalue) | Closure | PropertyValueValidator | |
| [and](#and) | Closure | AndValidator ||
| [or](#or) | Closure | OrValidator ||
| [eq](#eq) | Closure | EqualityValidator ||
Expand Down Expand Up @@ -190,34 +190,34 @@ const validator2 = enumerator("Red", "Yellow", "Green");

Nullish(`null` or `undefined`) validator.

## key
## propKey

[![abstruct:key](https://deno.bundlejs.com/?q=https://deno.land/x/abstruct/mod.ts&treeshake=[{+key+}]&badge=)](https://bundlejs.com/?q=https%3A%2F%2Fdeno.land%2Fx%2Fabstruct%2Fmod.ts&treeshake=%5B%7B+key+%7D%5D#sharing)
[![abstruct:propKey](https://deno.bundlejs.com/?q=https://deno.land/x/abstruct/mod.ts&treeshake=[{+propKey+}]&badge=)](https://bundlejs.com/?q=https%3A%2F%2Fdeno.land%2Fx%2Fabstruct%2Fmod.ts&treeshake=%5B%7B+propKey+%7D%5D#sharing)

Factory for property key validator.

```ts
import {
key,
propKey,
type Validator,
} from "https://deno.land/x/abstruct@$VERSION/mod.ts";
declare const validator: Validator<string>;
const keyValidator = key(validator);
const keyValidator = propKey(validator);
```

## value
## propValue

[![abstruct:value](https://deno.bundlejs.com/?q=https://deno.land/x/abstruct/mod.ts&treeshake=[{+value+}]&badge=)](https://bundlejs.com/?q=https%3A%2F%2Fdeno.land%2Fx%2Fabstruct%2Fmod.ts&treeshake=%5B%7B+value+%7D%5D#sharing)
[![abstruct:propValue](https://deno.bundlejs.com/?q=https://deno.land/x/abstruct/mod.ts&treeshake=[{+propValue+}]&badge=)](https://bundlejs.com/?q=https%3A%2F%2Fdeno.land%2Fx%2Fabstruct%2Fmod.ts&treeshake=%5B%7B+propValue+%7D%5D#sharing)

Factory for property value validator.

```ts
import {
propValue,
type Validator,
value,
} from "https://deno.land/x/abstruct@$VERSION/mod.ts";
declare const validator: Validator;
const valueValidator = value(validator);
const valueValidator = propValue(validator);
```

## and
Expand Down
4 changes: 2 additions & 2 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export {
int32,
int8,
item,
key,
lt,
lte,
maxCount,
Expand All @@ -58,6 +57,8 @@ export {
or,
pattern,
positive,
propKey,
propValue,
single,
string,
symbol,
Expand All @@ -67,7 +68,6 @@ export {
uint8,
unique,
validDate,
value,
} from "./bindings.ts";
export {
BasicValidator,
Expand Down

0 comments on commit ec6a956

Please sign in to comment.