• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ynixt / typescript-flat-serializer / 8368663386

21 Mar 2024 02:11AM UTC coverage: 93.462% (+0.6%) from 92.88%
8368663386

push

github

ynixt
feat: allow use without decorators

123 of 143 branches covered (86.01%)

Branch coverage included in aggregate %.

78 of 80 new or added lines in 7 files covered. (97.5%)

1 existing line in 1 file now uncovered.

506 of 530 relevant lines covered (95.47%)

58.04 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.11
/src/flat.ts
1
import { TSFlatCollectionOptions, registerTSFlatCollection } from './flat-collection';
1✔
2
import { TSFlatObjectProperties, registerTSFlatObject } from './flat-object';
1✔
3
import { TSFlatPropertyOptions, registerTSFlatProperty } from './flat-property';
1✔
4
import { Type } from './helpers';
1✔
5

1✔
6
export type FlatObjectRegistration<T> = {
1✔
7
  target: Type<T>;
1✔
8
  options?: TSFlatObjectProperties;
1✔
9
};
1✔
10

1✔
11
export type FlatPropertyRegistration<T> = {
1✔
12
  propertyName: keyof T;
1✔
13
  options?: TSFlatPropertyOptions;
1✔
14
};
1✔
15

1✔
16
export type FlatCollectionRegistration<T> = {
1✔
17
  collectionName: keyof T;
1✔
18
  options: TSFlatCollectionOptions;
1✔
19
};
1✔
20

1✔
21
export type FlatItem<T> = FlatPropertyRegistration<T> | FlatCollectionRegistration<T>;
1✔
22

1✔
23
export function registerTSFlat<T>(objectRegistration: FlatObjectRegistration<T>, ...items: FlatItem<T>[]) {
20✔
24
  registerTSFlatObject(objectRegistration.target, objectRegistration.options);
20✔
25

20✔
26
  if (items) {
20✔
27
    for (const item of items) {
20✔
28
      if ('collectionName' in item) {
18✔
29
        registerTSFlatCollection(objectRegistration.target.prototype, item.collectionName, item.options);
18✔
30
      } else if ('propertyName' in item) {
18!
NEW
31
        registerTSFlatProperty(objectRegistration.target.prototype, item.propertyName, item.options);
×
NEW
32
      }
×
33
    }
18✔
34
  }
20✔
35
}
20✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc