equal
deleted
inserted
replaced
1 import { JSONAPISerializer } from 'ember-cli-mirage'; |
1 import { JSONAPISerializer } from 'ember-cli-mirage'; |
2 |
2 |
3 import _ from 'lodash/lodash'; |
3 import _ from 'lodash'; |
4 |
4 |
5 export default JSONAPISerializer.extend({ |
5 export default JSONAPISerializer.extend({ |
6 serialize(response, request) { |
6 serialize(response, request) { |
7 |
7 |
8 let json = JSONAPISerializer.prototype.serialize.apply(this, arguments); |
8 let json = JSONAPISerializer.prototype.serialize.apply(this, arguments); |
14 resLang.attributes.count = Math.max(Math.floor(resLang.attributes.count / 2), 1); |
14 resLang.attributes.count = Math.max(Math.floor(resLang.attributes.count / 2), 1); |
15 return resLang; |
15 return resLang; |
16 })}; |
16 })}; |
17 } |
17 } |
18 |
18 |
19 return {'languages' : _(json.data).map((lang) => { return [lang.id, lang.attributes.count];}).object().value()}; |
19 return {'languages' : _(json.data).map((lang) => { return [lang.id, lang.attributes.count];}).fromPairs().value()}; |
20 } |
20 } |
21 }); |
21 }); |