@@ -11,7 +11,7 @@ const suite = new Benchmark.Suite();
1111const serializer = new JSONAPISerializer ( ) ;
1212const serializerConvert = new JSONAPISerializer ( {
1313 convertCase : 'kebab-case' ,
14- unconvertCase : 'camelCase'
14+ unconvertCase : 'camelCase' ,
1515} ) ;
1616
1717const data = [
@@ -27,32 +27,32 @@ const data = [
2727 lastName : 'Maggio' ,
2828 email : 'Kaley-Maggio@example.com' ,
2929 age : '80' ,
30- gender : 'male'
30+ gender : 'male' ,
3131 } ,
3232 tags : [ '1' , '2' ] ,
3333 photos : [
3434 'ed70cf44-9a34-4878-84e6-0c0e4a450cfe' ,
3535 '24ba3666-a593-498c-9f5d-55a4ee08c72e' ,
36- 'f386492d-df61-4573-b4e3-54f6f5d08acf'
36+ 'f386492d-df61-4573-b4e3-54f6f5d08acf' ,
3737 ] ,
3838 comments : [
3939 {
4040 _id : '1' ,
4141 body : 'First !' ,
42- created : '2015-08-14T18:42:16.475Z'
42+ created : '2015-08-14T18:42:16.475Z' ,
4343 } ,
4444 {
4545 _id : '2' ,
4646 body : 'I Like !' ,
47- created : '2015-09-14T18:42:12.475Z'
47+ created : '2015-09-14T18:42:12.475Z' ,
4848 } ,
4949 {
5050 _id : '3' ,
5151 body : 'Awesome' ,
52- created : '2015-09-15T18:42:12.475Z'
53- }
54- ]
55- }
52+ created : '2015-09-15T18:42:12.475Z' ,
53+ } ,
54+ ] ,
55+ } ,
5656] ;
5757
5858const articleSchema = {
@@ -62,7 +62,7 @@ const articleSchema = {
6262 self ( d ) {
6363 // Can be a function or a string value ex: { self: '/articles/1'}
6464 return `/articles/${ d . id } ` ;
65- }
65+ } ,
6666 } ,
6767 relationships : {
6868 // An object defining some relationships.
@@ -72,32 +72,32 @@ const articleSchema = {
7272 // An object or a function that describes Relationships links
7373 return {
7474 self : `/articles/${ d . id } /relationships/author` ,
75- related : `/articles/${ d . id } /author`
75+ related : `/articles/${ d . id } /author` ,
7676 } ;
77- }
77+ } ,
7878 } ,
7979 tags : {
80- type : 'tag'
80+ type : 'tag' ,
8181 } ,
8282 photos : {
83- type : 'photo'
83+ type : 'photo' ,
8484 } ,
8585 comments : {
8686 type : 'comment' ,
87- schema : 'only-body' // A custom schema
88- }
87+ schema : 'only-body' , // A custom schema
88+ } ,
8989 } ,
9090 topLevelMeta ( d , extraData ) {
9191 // An object or a function that describes top level meta.
9292 return {
9393 count : extraData . count ,
94- total : d . length
94+ total : d . length ,
9595 } ;
9696 } ,
9797 topLevelLinks : {
9898 // An object or a function that describes top level links.
99- self : '/articles'
100- }
99+ self : '/articles' ,
100+ } ,
101101} ;
102102serializer . register ( 'article' , articleSchema ) ;
103103serializerConvert . register ( 'article' , articleSchema ) ;
@@ -108,29 +108,29 @@ const peopleSchema = {
108108 links : {
109109 self ( d ) {
110110 return `/peoples/${ d . id } ` ;
111- }
112- }
111+ } ,
112+ } ,
113113} ;
114114serializer . register ( 'people' , peopleSchema ) ;
115115serializerConvert . register ( 'people' , peopleSchema ) ;
116116
117117// Register 'tag' type
118118const tagSchema = {
119- id : 'id'
119+ id : 'id' ,
120120} ;
121121serializer . register ( 'tag' , tagSchema ) ;
122122serializerConvert . register ( 'tag' , tagSchema ) ;
123123
124124// Register 'photo' type
125125const photoSchema = {
126- id : 'id'
126+ id : 'id' ,
127127} ;
128128serializer . register ( 'photo' , photoSchema ) ;
129129serializerConvert . register ( 'photo' , photoSchema ) ;
130130
131131// Register 'comment' type with a custom schema
132132const commentSchema = {
133- id : '_id'
133+ id : '_id' ,
134134} ;
135135serializer . register ( 'comment' , 'only-body' , commentSchema ) ;
136136serializerConvert . register ( 'comment' , 'only-body' , commentSchema ) ;
@@ -148,15 +148,15 @@ console.log('V8:', process.versions.v8);
148148
149149let cpus = os
150150 . cpus ( )
151- . map ( cpu => cpu . model )
151+ . map ( ( cpu ) => cpu . model )
152152 . reduce ( ( o , model ) => {
153153 if ( ! o [ model ] ) o [ model ] = 0 ;
154154 o [ model ] += 1 ;
155155 return o ;
156156 } , { } ) ;
157157
158158cpus = Object . keys ( cpus )
159- . map ( key => `${ key } \u00d7 ${ cpus [ key ] } ` )
159+ . map ( ( key ) => `${ key } \u00d7 ${ cpus [ key ] } ` )
160160 . join ( '\n' ) ;
161161
162162console . info ( cpus ) ;
@@ -170,7 +170,7 @@ suite
170170 serializer . serializeAsync ( 'article' , data , { count : 2 } ) . then ( ( ) => {
171171 deferred . resolve ( ) ;
172172 } ) ;
173- }
173+ } ,
174174 } )
175175 . add ( 'serialize' , ( ) => {
176176 serialized = serializer . serialize ( 'article' , data , { count : 2 } ) ;
@@ -184,7 +184,7 @@ suite
184184 serializer . deserializeAsync ( 'article' , serialized ) . then ( ( ) => {
185185 deferred . resolve ( ) ;
186186 } ) ;
187- }
187+ } ,
188188 } )
189189 . add ( 'deserialize' , ( ) => {
190190 serializer . deserialize ( 'article' , serialized ) ;
@@ -204,13 +204,13 @@ suite
204204 status : '422' ,
205205 source : { pointer : '/data/attributes/error' } ,
206206 title : 'Error' ,
207- detail : 'An error occured'
207+ detail : 'An error occured' ,
208208 } ;
209209
210210 serializer . serializeError ( jsonapiError ) ;
211211 } )
212212 // add listeners
213- . on ( 'cycle' , event => {
213+ . on ( 'cycle' , ( event ) => {
214214 console . log ( String ( event . target ) ) ;
215215 } )
216216 . on ( 'complete' , ( ) => { } )
0 commit comments