Skip to content

Commit ce726fb

Browse files
committed
style(serializers/json-api): fixes according to airbnb-javascript guide
1 parent 094964e commit ce726fb

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/serializers/json-api.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
//TODO: Implement 'included' support after relationships
1+
import _ from 'lodash';
2+
3+
// @TODO (zzarcon): Implement 'included' support after relationships
24
export const JSONApiSerializer = (record = {}, type = null) => {
35
const id = record.id;
4-
const relationships = {};
56
const included = [];
6-
7-
delete record.id;
7+
const relationships = {};
8+
const serializedRecord = _.pickBy(record, (value, key) => key !== 'id');
89

910
return {
1011
data: {
1112
id,
12-
attributes: record,
13+
attributes: serializedRecord,
1314
relationships,
14-
type
15+
type,
1516
},
16-
included
17+
included,
1718
};
18-
};
19+
};

0 commit comments

Comments
 (0)