Skip to content

Commit 516ba33

Browse files
committed
# 1.3.4
## Update - Documentation updated
1 parent 91db6e6 commit 516ba33

36 files changed

+436
-223
lines changed

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 Anton Trofimenko
3+
Copyright (c) 2022 Anton Trofimenko
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,15 @@ Documentation [https://corefunc.github.io/type](https://corefunc.github.io/type)
1414

1515
---
1616

17-
## See also
18-
1917
[💾 My other projects](https://r37r0m0d3l.icu/open_source_map)
2018

2119
<img alt="Open Source" src="https://raw.githubusercontent.com/r37r0m0d3l/r37r0m0d3l/master/osmap.svg?sanitize=true" width="960" height="520" style="display:block;height:auto;margin-left:auto;margin-right:auto;min-height:520px;min-width:960px;width:100%;">
2220

2321
<!-- Badges -->
2422

25-
[npm-version-url]: https://npmjs.com/package/@nestjsi/class-validator
26-
[npm-version-img]: https://badgen.net/npm/v/@nestjsi/class-validator?&icon=npm&label=npm&color=DD3636
27-
[npm-downloads-url]: https://npmjs.com/package/@nestjsi/class-validator
28-
[npm-downloads-img]: https://badgen.net/npm/dt/@nestjsi/class-validator?&icon=terminal&label=downloads&color=009688
29-
[ts-url]: https://github.com/nestjsi/class-validator/blob/main/dist/index.d.ts
30-
[ts-img]: https://badgen.net/npm/types/@nestjsi/class-validator?&icon=typescript&label=types&color=1E90FF
23+
[npm-version-url]: https://npmjs.com/package/@corefunc/type
24+
[npm-version-img]: https://badgen.net/npm/v/@corefunc/type?&icon=npm&label=npm&color=DD3636
25+
[npm-downloads-url]: https://npmjs.com/package/@corefunc/type
26+
[npm-downloads-img]: https://badgen.net/npm/dt/@corefunc/type?&icon=terminal&label=downloads&color=009688
27+
[ts-url]: https://github.com/corefunc/type/blob/master/index.d.ts
28+
[ts-img]: https://badgen.net/npm/types/@corefunc/type?&icon=typescript&label=types&color=1E90FF

class/key-of-class.cjs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"use strict";
2+
exports.__esModule = true;
3+
exports.keyOfClass = void 0;
4+
/**
5+
* @category Class
6+
* @name keyOfClass
7+
* @description Checks if name is a key of class. String only, no Symbols or Numbers.
8+
* @summary ```import type { keyOfClass } from "@corefunc/type/class/key-of-class";```
9+
* @returns {string}
10+
* @since 1.3.2
11+
*/
12+
function keyOfClass(propertyName) {
13+
return String(propertyName);
14+
}
15+
exports.keyOfClass = keyOfClass;

class/key-of-class.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @name keyOfClass
44
* @description Checks if name is a key of class. String only, no Symbols or Numbers.
55
* @summary ```import type { keyOfClass } from "@corefunc/type/class/key-of-class";```
6-
* @returns {(propertyName: string) => string}
6+
* @returns {string}
77
* @since 1.3.2
88
*/
99
export declare function keyOfClass<ClassName>(propertyName: keyof ClassName): string;

class/key-of-class.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ exports.keyOfClass = void 0;
66
* @name keyOfClass
77
* @description Checks if name is a key of class. String only, no Symbols or Numbers.
88
* @summary ```import type { keyOfClass } from "@corefunc/type/class/key-of-class";```
9-
* @returns {(propertyName: string) => string}
9+
* @returns {string}
1010
* @since 1.3.2
1111
*/
1212
function keyOfClass(propertyName) {

class/key-of-class.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* @category Class
3+
* @name keyOfClass
4+
* @description Checks if name is a key of class. String only, no Symbols or Numbers.
5+
* @summary ```import type { keyOfClass } from "@corefunc/type/class/key-of-class";```
6+
* @returns {string}
7+
* @since 1.3.2
8+
*/
9+
export function keyOfClass(propertyName) {
10+
return String(propertyName);
11+
}

class/key-of-class.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @name keyOfClass
44
* @description Checks if name is a key of class. String only, no Symbols or Numbers.
55
* @summary ```import type { keyOfClass } from "@corefunc/type/class/key-of-class";```
6-
* @returns {(propertyName: string) => string}
6+
* @returns {string}
77
* @since 1.3.2
88
*/
99
export function keyOfClass<ClassName>(propertyName: keyof ClassName): string {

docs/README.md

Lines changed: 0 additions & 197 deletions
Original file line numberDiff line numberDiff line change
@@ -8,203 +8,6 @@ TypeScript common types.
88
[![NPM Downloads][npm-downloads-img]][npm-downloads-url]
99
[![TypeScript Typings][ts-img]][ts-url]
1010

11-
# Reference
12-
13-
## Class
14-
15-
### Complete
16-
17-
```typescript
18-
import type { CompleteType } from "@corefunc/type/class/complete.type";
19-
interface UserInterface {
20-
name: string;
21-
zip: string;
22-
}
23-
// Forces class to implement all interface properties.
24-
class User implements CompleteType<UserInterface> {
25-
public name: string;
26-
public zip: string;
27-
}
28-
```
29-
30-
### Concrete
31-
32-
```typescript
33-
import type { ConcreteType } from "@corefunc/type/class/concrete.type";
34-
interface UserInterface {
35-
email: string;
36-
nickname?: string;
37-
}
38-
// Disallow 'optional' properties from inherited type.
39-
class User implements ConcreteType<UserInterface> {
40-
email: string;
41-
nickname: string | undefined;
42-
}
43-
```
44-
45-
### Constructor
46-
47-
```typescript
48-
import type { ConstructorType } from "@corefunc/type/class/constructor.type";
49-
50-
class ExchangeClient {}
51-
52-
function mixinApiPostUser<T extends ConstructorType<ExchangeClient>>(superClass: T) {
53-
return class extends superClass {
54-
public postUser(data: any) {
55-
return this.post(`/users/`, data);
56-
}
57-
};
58-
}
59-
60-
function mixinApiGetUser<T extends ConstructorType<ExchangeClient>>(superClass: T) {
61-
return class extends superClass {
62-
public getUser(id: string) {
63-
return this.get(`/users/${id}`);
64-
}
65-
};
66-
}
67-
68-
class ApiClient extends mixinApiPostUser(mixinApiGetUser(ExchangeClient)) {}
69-
```
70-
71-
### Key of class
72-
73-
```typescript
74-
import { keyOfClass } from "@corefunc/type/class/key-of-class";
75-
class User {
76-
public static readonly name: string = keyOfClass<User>("name");
77-
public readonly name: string;
78-
}
79-
```
80-
81-
## JSON
82-
83-
### JSON types
84-
85-
```typescript
86-
import type {
87-
JsonPrimitiveType,
88-
JsonArrayType,
89-
JsonObjectType,
90-
JsonType,
91-
} from "@corefunc/type/json";
92-
```
93-
94-
## Number
95-
96-
### Float
97-
98-
```typescript
99-
import { isFloatRange, assertFloatRange } from "@corefunc/type";
100-
import { TypeFloatRange, FloatRangeType, FloatRange } from "@corefunc/type";
101-
const value: TypeFloatRange<0.01, 99.99> = 10.5;
102-
```
103-
104-
### Integer 16
105-
106-
```typescript
107-
import { isInteger16, assertInteger16, INT16, INT16_MAX, INT16_MIN } from "@corefunc/type";
108-
import type { TypeInteger16, Integer16Type, Integer16 } from "@corefunc/type";
109-
const value: TypeInteger16 = 32_767;
110-
```
111-
112-
### Integer 32
113-
114-
```typescript
115-
import { isInteger32, assertInteger32, INT32, INT32_MAX, INT32_MIN } from "@corefunc/type";
116-
import type { TypeInteger32, Integer32Type, Integer32 } from "@corefunc/type";
117-
const value: TypeInteger32 = 2_147_483_647;
118-
```
119-
120-
### Integer 64
121-
122-
```typescript
123-
import { isInteger64, assertInteger64, INT64, INT64_MAX, INT64_MIN } from "@corefunc/type";
124-
import type { TypeInteger64, Integer64Type, Integer64 } from "@corefunc/type";
125-
const value: TypeInteger64 = 9_223_372_036_854_775_807;
126-
```
127-
128-
### Integer Range
129-
130-
```typescript
131-
import { isIntegerRange, assertIntegerRange } from "@corefunc/type";
132-
import type { TypeIntegerRange, IntegerRangeType, IntegerRange } from "@corefunc/type";
133-
const value: TypeIntegerRange<0, 100> = 50;
134-
```
135-
136-
### Numeric
137-
138-
```typescript
139-
import { isNumeric, assertNumeric } from "@corefunc/type";
140-
import type { TypeNumeric, NumericType, Numeric } from "@corefunc/type";
141-
const value: TypeNumeric<5, 2> = 999.99;
142-
```
143-
144-
## String
145-
146-
### String Date
147-
148-
```typescript
149-
import { isStringDate, assertStringDate } from "@corefunc/type";
150-
import type { TypeStringDate, StringDateType, StringDate } from "@corefunc/type";
151-
const value: StringDate = "2020-01-01";
152-
```
153-
154-
### String Fixed
155-
156-
```typescript
157-
import { isStringFixed, assertStringFixed } from "@corefunc/type";
158-
import type { TypeStringFixed, StringFixedType, StringFixed } from "@corefunc/type";
159-
const value: StringFixed<3> = "USD";
160-
```
161-
162-
### String Of Length
163-
164-
```typescript
165-
import { isStringOfLength, assertStringOfLength } from "@corefunc/type";
166-
import type { TypeStringOfLength, StringOfLengthType, StringOfLength } from "@corefunc/type";
167-
const value: StringOfLength<2, 99> = "Billy";
168-
```
169-
170-
### String Time
171-
172-
```typescript
173-
import { isStringTime, assertStringTime } from "@corefunc/type";
174-
import type { TypeStringTime, StringTimeType, StringTime } from "@corefunc/type";
175-
const value: StringTime = "12:59";
176-
```
177-
178-
### String Varying
179-
180-
```typescript
181-
import { isStringVarying, assertStringVarying } from "@corefunc/type";
182-
import type { TypeStringVarying, StringVaryingType, StringVarying } from "@corefunc/type";
183-
const value: StringVarying<254> = "user+inbox@domain";
184-
```
185-
186-
### UUID
187-
188-
```typescript
189-
import { isUuid, assertUuid } from "@corefunc/type";
190-
import type { TypeUUID, UUIDType, UUID } from "@corefunc/type";
191-
const value: UUID = "0b0bc0f0-db42-11eb-8d19-0242ac130003";
192-
```
193-
194-
### UUID 4
195-
196-
```typescript
197-
import { isUuid4, assertUuid4 } from "@corefunc/type";
198-
import type { TypeUUID4, UUID4Type, UUID4 } from "@corefunc/type";
199-
const value: UUID4 = "155fbaaf-09de-4141-80df-94696eed4cb6";
200-
```
201-
202-
## See also
203-
204-
[💾 My other projects](https://r37r0m0d3l.icu/open_source_map)
205-
206-
<img alt="Open Source" src="https://raw.githubusercontent.com/r37r0m0d3l/r37r0m0d3l/master/osmap.svg?sanitize=true" width="960" height="520" style="display:block;height:auto;margin-left:auto;margin-right:auto;min-height:520px;min-width:960px;width:100%;">
207-
20811
<!-- Badges -->
20912

21013
[npm-version-url]: https://npmjs.com/package/@corefunc/type

docs/_sidebar.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
- Class
2+
- [Complete](/class/complete.type.md)
3+
- [Concrete](/class/concrete.type.md)
4+
- [Constructor](/class/constructor.type.md)
5+
- [Key Of Class](/class/key-of-class.md)
6+
- JSON
7+
- [JSON](/json/json.md)
8+
- Number
9+
- [Float Range](/number/float-range.type.md)
10+
- [Integer 16](/number/integer-16.type.md)
11+
- [Integer 32](/number/integer-32.type.md)
12+
- [Integer 64](/number/integer-64.type.md)
13+
- [Integer Range](/number/integer-range.type.md)
14+
- [Numeric](/number/numeric-type.md)
15+
- String
16+
- [String Date](/string/string-date.type.md)
17+
- [String Fixed](/string/string-fixed.type.md)
18+
- [String Of Length](/string/string-of-length.type.md)
19+
- [String Time](/string/string-time.type.md)
20+
- [String Varying](/string/string-varying.type.md)
21+
- [UUID](/string/uuid.type.md)
22+
- [UUID4](/string/uuid4.type.md)
23+
- Other
24+
- [Changelog](/other/changelog.md)
25+
- [See also](/other/see_also.md)

docs/class/complete.type.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Class
2+
3+
## Complete
4+
5+
> Forces class to implement all interface properties.
6+
7+
_Since `1.1.0`_
8+
9+
```typescript
10+
import type { CompleteType } from "@corefunc/type/class/complete.type";
11+
12+
interface UserInterface {
13+
name: string;
14+
zip: string;
15+
}
16+
17+
class User implements CompleteType<UserInterface> {
18+
public name: string;
19+
public zip: string;
20+
}
21+
```

0 commit comments

Comments
 (0)