Skip to content

Commit 7fa94b1

Browse files
authored
chore(Dependencies): Update lib dependencies (#178)
Node v8.x end of life is December 31st, 2019. Please upgrade to v10.x BREAKING CHANGE: Node version 8.x not supported anymore. Upgrade to v10.x or superior.
1 parent ac52ffb commit 7fa94b1

29 files changed

+1532
-1121
lines changed

.eslintrc.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"mocha"
1414
],
1515
"rules": {
16+
"arrow-parens": ["error", "as-needed"],
1617
"indent": [
1718
"error",
1819
4,
@@ -51,6 +52,7 @@
5152
"objects": "always-multiline",
5253
"functions": "ignore"
5354
}
54-
]
55+
],
56+
"strict": ["error", "global"]
5557
}
5658
}

.travis.yml

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: node_js
22
node_js:
33
- "lts/*"
4-
- "8"
4+
- "10"
55

66
branches:
77
only:
@@ -15,22 +15,6 @@ script:
1515
after_success:
1616
- npm run coveralls
1717

18-
sudo: required
19-
before_install:
20-
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.14.0
21-
- export PATH=$HOME/.yarn/bin:$PATH
22-
- yarn global add node-gyp node-pre-gyp
23-
24-
env:
25-
- CXX=g++-5
26-
27-
# https://stackoverflow.com/a/40802733/5642633
28-
addons:
29-
apt:
30-
sources:
31-
- ubuntu-toolchain-r-test
32-
packages:
33-
- g++-5
3418
cache:
3519
yarn: true
3620

lib/dataloader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function createDataLoader(ds) {
2828
// calls return an Array
2929
const entities = arrify(res);
3030
const entitiesByKey = {};
31-
entities.forEach((entity) => {
31+
entities.forEach(entity => {
3232
entitiesByKey[keyToString(entity[ds.KEY])] = entity;
3333
});
3434

lib/entity.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class Entity {
9393
if (_this.constructor.__hasCache(options)) {
9494
return _this.constructor.clearCache()
9595
.then(() => _this)
96-
.catch((err) => {
96+
.catch(err => {
9797
let msg = 'Error while clearing the cache after saving the entity.';
9898
msg += 'The entity has been saved successfully though. ';
9999
msg += 'Both the cache error and the entity saved have been attached.';
@@ -170,7 +170,7 @@ class Entity {
170170
return;
171171
}
172172

173-
this.schema.__meta.geoPointsProps.forEach((property) => {
173+
this.schema.__meta.geoPointsProps.forEach(property => {
174174
if ({}.hasOwnProperty.call(_this.entityData, property)
175175
&& _this.entityData[property] !== null
176176
&& _this.entityData[property].constructor.name !== 'GeoPoint') {
@@ -301,9 +301,9 @@ class Entity {
301301

302302
getEntityDataWithVirtuals() {
303303
const { virtuals } = this.schema;
304-
const entityData = Object.assign({}, this.entityData);
304+
const entityData = { ...this.entityData };
305305

306-
Object.keys(virtuals).forEach((k) => {
306+
Object.keys(virtuals).forEach(k => {
307307
if ({}.hasOwnProperty.call(entityData, k)) {
308308
virtuals[k].applySetters(entityData[k], entityData);
309309
} else {
@@ -381,15 +381,15 @@ function buildEntityData(self, data) {
381381
const { error, value } = schema.validateJoi(data);
382382

383383
if (!error) {
384-
entityData = Object.assign({}, value);
384+
entityData = { ...value };
385385
}
386386
}
387387

388-
entityData = Object.assign({}, entityData, data);
388+
entityData = { ...entityData, ...data };
389389

390390
let isTypeArray;
391391

392-
Object.keys(schema.paths).forEach((k) => {
392+
Object.keys(schema.paths).forEach(k => {
393393
const prop = schema.paths[k];
394394
const hasValue = {}.hasOwnProperty.call(entityData, k);
395395
const isOptional = {}.hasOwnProperty.call(prop, 'optional') && prop.optional !== false;
@@ -471,12 +471,12 @@ function registerHooksFromSchema(self) {
471471
}
472472

473473
// Add Pre hooks
474-
callQueue[method].pres.forEach((fn) => {
474+
callQueue[method].pres.forEach(fn => {
475475
self.pre(method, fn);
476476
});
477477

478478
// Add Pre hooks
479-
callQueue[method].post.forEach((fn) => {
479+
callQueue[method].post.forEach(fn => {
480480
self.post(method, fn);
481481
});
482482
}

lib/errors.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint no-use-before-define: "off" */
1+
/* eslint-disable max-classes-per-file, no-use-before-define */
22

33
'use strict';
44

@@ -50,7 +50,7 @@ class GstoreError extends Error {
5050
this.code = code || errorCodes.ERR_GENERIC;
5151

5252
if (args) {
53-
Object.keys(args).forEach((k) => {
53+
Object.keys(args).forEach(k => {
5454
if (k !== 'messageParams') {
5555
this[k] = args[k];
5656
}

lib/helpers/defaultValues.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const map = {
66
CURRENT_DATETIME: timeNow,
77
};
88

9-
const handler = (value) => {
9+
const handler = value => {
1010
if (({}).hasOwnProperty.call(map, value)) {
1111
return map[value]();
1212
}

lib/helpers/queryhelpers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function buildFromOptions(query, options, ds) {
2323
if (!options.order.length) {
2424
options.order = [options.order];
2525
}
26-
options.order.forEach((order) => {
26+
options.order.forEach(order => {
2727
query.order(order.property, {
2828
descending: {}.hasOwnProperty.call(order, 'descending') ? order.descending : false,
2929
});
@@ -56,7 +56,7 @@ function buildFromOptions(query, options, ds) {
5656
}
5757

5858
if (options.filters[0].length > 1) {
59-
options.filters.forEach((filter) => {
59+
options.filters.forEach(filter => {
6060
// We check if the value is a function
6161
// if it is, we execute it.
6262
let value = filter[filter.length - 1];

lib/helpers/validation.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const is = require('is');
66

77
const gstoreErrors = require('../errors');
88

9-
const isValidDate = (value) => {
9+
const isValidDate = value => {
1010
if (value.constructor.name !== 'Date'
1111
&& (typeof value !== 'string'
1212
|| !value.match(/\d{4}-\d{2}-\d{2}([ ,T])?(\d{2}:\d{2}:\d{2})?(\.\d{1,3})?/)
@@ -24,7 +24,7 @@ const isValueEmpty = v => (
2424
v === null || v === undefined || (typeof v === 'string' && v.trim().length === 0)
2525
);
2626

27-
const isValidLngLat = (data) => {
27+
const isValidLngLat = data => {
2828
const validLatitude = (isInt(data.latitude) || isFloat(data.latitude))
2929
&& data.latitude >= -90 && data.latitude <= 90;
3030
const validLongitude = (isInt(data.longitude) || isFloat(data.longitude))
@@ -310,7 +310,7 @@ const validate = (entityData, schema, entityKind, datastore) => {
310310

311311
return Promise.resolve(onSuccess(entityData));
312312
},
313-
catch: (onError) => {
313+
catch: onError => {
314314
if (validationError) {
315315
return Promise.resolve(onError(validationError));
316316
}

lib/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Gstore {
3838
this.models = {};
3939
this.modelSchemas = {};
4040
this.options = {};
41-
this.config = Object.assign({}, defaultConfig, config);
41+
this.config = { ...defaultConfig, ...config };
4242
this.Schema = Schema;
4343
this.Queries = queries;
4444
this._defaultValues = defaultValues;
@@ -118,7 +118,7 @@ class Gstore {
118118
*/
119119
if (options.validate) {
120120
let error;
121-
const validateEntity = (entity) => {
121+
const validateEntity = entity => {
122122
({ error } = entity.validate());
123123
if (error) {
124124
throw error;

0 commit comments

Comments
 (0)