Skip to content

Commit bbb5b4b

Browse files
committed
Update dependencies
1 parent 1399865 commit bbb5b4b

File tree

7 files changed

+1072
-253
lines changed

7 files changed

+1072
-253
lines changed

.eslintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"plugin:jsdoc/recommended",
77
],
88
"parserOptions": {
9-
"ecmaVersion": 6
9+
"ecmaVersion": 2018
1010
},
1111
"env": {
1212
"node": true,

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules/
22
coverage/
3+
.nyc_output/
34
.idea/

lib/JSONAPISerializer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ module.exports = class JSONAPISerializer {
5757
}
5858

5959
schema = schema || 'default';
60-
options = Object.assign({}, this.opts, options);
60+
options = { ...this.opts, ...options };
6161

6262
this.schemas[type] = this.schemas[type] || {};
6363
this.schemas[type][schema] = validateOptions(options);

lib/lru-cache.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable */
2+
13
// Influenced by http://jsfiddle.net/2baax9nk/5/
24

35
class Node {

lib/validator.js

+21-21
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,20 @@
77
* @returns {object} valid configuration options.
88
*/
99
function validateOptions(options) {
10-
options = Object.assign(
11-
{
12-
id: 'id',
13-
blacklist: [],
14-
whitelist: [],
15-
links: {},
16-
relationships: {},
17-
topLevelLinks: {},
18-
topLevelMeta: {},
19-
meta: {},
20-
blacklistOnDeserialize: [],
21-
whitelistOnDeserialize: [],
22-
jsonapiObject: true
23-
},
24-
options
25-
);
10+
options = {
11+
id: 'id',
12+
blacklist: [],
13+
whitelist: [],
14+
links: {},
15+
relationships: {},
16+
topLevelLinks: {},
17+
topLevelMeta: {},
18+
meta: {},
19+
blacklistOnDeserialize: [],
20+
whitelistOnDeserialize: [],
21+
jsonapiObject: true,
22+
...options
23+
};
2624

2725
if (!Array.isArray(options.blacklist)) throw new Error("option 'blacklist' must be an array");
2826
if (!Array.isArray(options.whitelist)) throw new Error("option 'whitelist' must be an array");
@@ -64,10 +62,12 @@ function validateOptions(options) {
6462

6563
const { relationships } = options;
6664
Object.keys(relationships).forEach(key => {
67-
relationships[key] = Object.assign(
68-
{ schema: 'default', links: {}, meta: {} },
69-
relationships[key]
70-
);
65+
relationships[key] = {
66+
schema: 'default',
67+
links: {},
68+
meta: {},
69+
...relationships[key]
70+
};
7171

7272
if (!relationships[key].type)
7373
throw new Error(`option 'type' for relationship '${key}' is required`);
@@ -110,7 +110,7 @@ function validateOptions(options) {
110110
* @returns {object} valid dynamic type options.
111111
*/
112112
function validateDynamicTypeOptions(options) {
113-
options = Object.assign({ topLevelLinks: {}, topLevelMeta: {}, jsonapiObject: true }, options);
113+
options = { topLevelLinks: {}, topLevelMeta: {}, jsonapiObject: true, ...options };
114114

115115
if (!options.type) throw new Error("option 'type' is required");
116116
if (typeof options.type !== 'string' && typeof options.type !== 'function') {

0 commit comments

Comments
 (0)