loginterface 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
- package/readme.md +45 -0
package/dist/index.d.ts
CHANGED
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
* this.http.get('/endpoint').pipe(map(res => res.data), generateInterface('Interface name'))
|
|
9
9
|
* ```
|
|
10
10
|
*/
|
|
11
|
-
export declare const logInterface: (interfaceName: string) => any
|
|
11
|
+
export declare const logInterface: (interfaceName: string) => import("rxjs").MonoTypeOperatorFunction<any>;
|
package/package.json
CHANGED
package/readme.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# logInterface
|
|
2
|
+
RxJS operator that generates interfaces and logs them into console with styling. Simply copy from console into your file
|
|
3
|
+
|
|
4
|
+
### Example usage (Angular)
|
|
5
|
+
```ts
|
|
6
|
+
this.http.get('/endpoint').pipe(logInterface('Interface name'))
|
|
7
|
+
```
|
|
8
|
+
#### Example
|
|
9
|
+
```ts
|
|
10
|
+
const person = {
|
|
11
|
+
name: 'John',
|
|
12
|
+
lastname: 'Doe',
|
|
13
|
+
age: 30,
|
|
14
|
+
address:{
|
|
15
|
+
street: 'Highroad',
|
|
16
|
+
number: 100
|
|
17
|
+
},
|
|
18
|
+
items: [
|
|
19
|
+
{ pencil: true, gloves: true }
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
of(person).pipe(logInterface('Person')).subscribe()
|
|
24
|
+
//will log the following into console
|
|
25
|
+
|
|
26
|
+
export interface Person {
|
|
27
|
+
name: string;
|
|
28
|
+
lastname: string;
|
|
29
|
+
age: number;
|
|
30
|
+
address: PersonAddress;
|
|
31
|
+
items: PersonItems[];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface PersonAddress {
|
|
35
|
+
street: string;
|
|
36
|
+
streetNumber: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface PersonItems {
|
|
40
|
+
pencil: boolean;
|
|
41
|
+
gloves: boolean;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
```
|