Skip to content
This repository was archived by the owner on Jan 25, 2023. It is now read-only.

Commit d4496e2

Browse files
committed
rename megapost to compound
1 parent 505fccf commit d4496e2

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class ListItemSerializer extends JSONAPISerializer {
8585
}
8686

8787

88-
new ListItemSerializer.serialize({data,meta,lang,includeWhitelistKeys, megapost})
88+
new ListItemSerializer.serialize({data,meta,lang,includeWhitelistKeys, compound})
8989
```
9090

9191
#### Available serialize config params
@@ -94,7 +94,7 @@ new ListItemSerializer.serialize({data,meta,lang,includeWhitelistKeys, megapost}
9494
- **meta**: (optional) object to set as meta response
9595
- **lang**: (optional) string for i18n purposes
9696
- **includeWhitelistKeys**: (optional) csv string for bounding included entities. If not set all entities will be set on included array response
97-
- **megapost**: (optional default:false) serialize as megapost
97+
- **compound**: (optional default:false) serialize as megapost
9898

9999
#### Available serializerConfig return object props
100100

@@ -296,7 +296,7 @@ const listItemSerializer = new ListItemSerializer();
296296
// nested with includes
297297
const output = listItemSerializer.serialize({
298298
data: inputData,
299-
megapost: true,
299+
compound: true,
300300
});
301301

302302
console.log(output);

src/index.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ export class JSONAPISerializer {
302302
serializedEntities: JSONApiResource[],
303303
lang: string,
304304
includeWhitelistKeys: string[] | null,
305-
megapost: boolean
305+
compound: boolean
306306
): JSONApiResource {
307307
const entityId = get(data, "id");
308308
const entityType = get(data, "type") || config.type;
@@ -398,10 +398,10 @@ export class JSONAPISerializer {
398398
serializedEntities,
399399
lang,
400400
newIncludeWhitelistKeys,
401-
megapost
401+
compound
402402
);
403403

404-
if (megapost) {
404+
if (compound) {
405405
output.relationships[dashCaseKey].data[i] = serializedEntity;
406406
} else {
407407
this.addToIncluded(includedEntities, serializedEntity);
@@ -427,10 +427,10 @@ export class JSONAPISerializer {
427427
serializedEntities,
428428
lang,
429429
newIncludeWhitelistKeys,
430-
megapost
430+
compound
431431
);
432432

433-
if (megapost) {
433+
if (compound) {
434434
output.relationships[dashCaseKey].data = serializedEntity;
435435
} else {
436436
this.addToIncluded(includedEntities, serializedEntity);
@@ -494,7 +494,7 @@ export class JSONAPISerializer {
494494
meta,
495495
lang,
496496
includeWhitelistKeys,
497-
megapost,
497+
compound,
498498
}) {
499499
const output: any = {};
500500
let entities;
@@ -512,7 +512,7 @@ export class JSONAPISerializer {
512512
serializedEntities,
513513
lang,
514514
includeWhitelistKeys,
515-
megapost
515+
compound
516516
);
517517
});
518518
} else {
@@ -523,7 +523,7 @@ export class JSONAPISerializer {
523523
serializedEntities,
524524
lang,
525525
includeWhitelistKeys,
526-
megapost
526+
compound
527527
);
528528
}
529529

@@ -546,15 +546,15 @@ export class JSONAPISerializer {
546546
meta,
547547
lang,
548548
includeWhitelistKeys,
549-
megapost = false,
549+
compound = false,
550550
} = request;
551551
return this._serialize({
552552
data,
553553
config: this.serializerConfig(),
554554
meta,
555555
lang,
556556
includeWhitelistKeys,
557-
megapost,
557+
compound,
558558
});
559559
}
560560
}

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ export type SerializeRequest = {
5757
meta?: any;
5858
lang?: string;
5959
includeWhitelistKeys?: string;
60-
megapost?: boolean;
60+
compound?: boolean;
6161
};

0 commit comments

Comments
 (0)