不要怂,就是干,撸起袖子干!

Commit 73f1b5d1 by Sushant Committed by GitHub

build: update dependencies (#11099)

1 parent 920a5c88
......@@ -41,14 +41,14 @@ script:
jobs:
include:
- stage: lint
node_js: '6'
node_js: '8'
script:
- npm run lint
- npm run lint-docs
- npm run test-typings
- stage: test
node_js: '6'
env: DIALECT=sqlite TSC=true
env: DIALECT=sqlite
- stage: test
node_js: '6'
sudo: required
......
......@@ -416,7 +416,7 @@ class BelongsToMany extends Association {
}
let model = this.target;
if (options.hasOwnProperty('scope')) {
if (Object.prototype.hasOwnProperty.call(options, 'scope')) {
if (!options.scope) {
model = model.unscoped();
} else {
......@@ -424,7 +424,7 @@ class BelongsToMany extends Association {
}
}
if (options.hasOwnProperty('schema')) {
if (Object.prototype.hasOwnProperty.call(options, 'schema')) {
model = model.schema(options.schema, options.schemaDelimiter);
}
......
......@@ -130,7 +130,7 @@ class BelongsTo extends Association {
options = Utils.cloneDeep(options);
if (options.hasOwnProperty('scope')) {
if (Object.prototype.hasOwnProperty.call(options, 'scope')) {
if (!options.scope) {
Target = Target.unscoped();
} else {
......@@ -138,7 +138,7 @@ class BelongsTo extends Association {
}
}
if (options.hasOwnProperty('schema')) {
if (Object.prototype.hasOwnProperty.call(options, 'schema')) {
Target = Target.schema(options.schema, options.schemaDelimiter);
}
......
......@@ -211,7 +211,7 @@ class HasMany extends Association {
{ [Op.and]: [where, options.where] } :
where;
if (options.hasOwnProperty('scope')) {
if (Object.prototype.hasOwnProperty.call(options, 'scope')) {
if (!options.scope) {
Model = Model.unscoped();
} else {
......@@ -219,7 +219,7 @@ class HasMany extends Association {
}
}
if (options.hasOwnProperty('schema')) {
if (Object.prototype.hasOwnProperty.call(options, 'schema')) {
Model = Model.schema(options.schema, options.schemaDelimiter);
}
......
......@@ -130,7 +130,7 @@ class HasOne extends Association {
options = Utils.cloneDeep(options);
if (options.hasOwnProperty('scope')) {
if (Object.prototype.hasOwnProperty.call(options, 'scope')) {
if (!options.scope) {
Target = Target.unscoped();
} else {
......@@ -138,7 +138,7 @@ class HasOne extends Association {
}
}
if (options.hasOwnProperty('schema')) {
if (Object.prototype.hasOwnProperty.call(options, 'schema')) {
Target = Target.schema(options.schema, options.schemaDelimiter);
}
......
'use strict';
function checkNamingCollision(association) {
if (association.source.rawAttributes.hasOwnProperty(association.as)) {
if (Object.prototype.hasOwnProperty.call(association.source.rawAttributes, association.as)) {
throw new Error(
`Naming collision between attribute '${association.as}'` +
` and association '${association.as}' on model ${association.source.name}` +
......@@ -57,7 +57,7 @@ function mixinMethods(association, obj, methods, aliases) {
for (const method of methods) {
// don't override custom methods
if (!obj.hasOwnProperty(association.accessors[method])) {
if (!Object.prototype.hasOwnProperty.call(obj, association.accessors[method])) {
const realMethod = aliases[method] || method;
obj[association.accessors[method]] = function() {
......
......@@ -1021,7 +1021,7 @@ const DataTypes = module.exports = {
_.each(DataTypes, (dataType, name) => {
// guard for aliases
if (!dataType.hasOwnProperty('key')) {
if (!Object.prototype.hasOwnProperty.call(dataType, 'key')) {
dataType.types = {};
dataType.key = dataType.prototype.key = name;
}
......
......@@ -44,7 +44,7 @@ class ConnectionManager {
refreshTypeParser(dataTypes) {
_.each(dataTypes, dataType => {
if (dataType.hasOwnProperty('parse')) {
if (Object.prototype.hasOwnProperty.call(dataType, 'parse')) {
if (dataType.types[this.dialectName]) {
this._refreshTypeParser(dataType);
} else {
......
......@@ -199,7 +199,7 @@ class QueryGenerator {
valueHash = Utils.removeNullValuesFromHash(valueHash, this.options.omitNull);
for (const key in valueHash) {
if (valueHash.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(valueHash, key)) {
const value = valueHash[key];
fields.push(this.quoteIdentifier(key));
......@@ -1277,7 +1277,7 @@ class QueryGenerator {
}
// Add WHERE to sub or main query
if (options.hasOwnProperty('where') && !options.groupedLimit) {
if (Object.prototype.hasOwnProperty.call(options, 'where') && !options.groupedLimit) {
options.where = this.getWhereConditions(options.where, mainTable.as || tableName, model, options);
if (options.where) {
if (subQuery) {
......@@ -1305,7 +1305,7 @@ class QueryGenerator {
}
// Add HAVING to sub or main query
if (options.hasOwnProperty('having')) {
if (Object.prototype.hasOwnProperty.call(options, 'having')) {
options.having = this.getWhereConditions(options.having, tableName, model, options, false);
if (options.having) {
if (subQuery) {
......@@ -1948,7 +1948,7 @@ class QueryGenerator {
handleSequelizeMethod(smth, tableName, factory, options, prepend) {
let result;
if (this.OperatorMap.hasOwnProperty(smth.comparator)) {
if (Object.prototype.hasOwnProperty.call(this.OperatorMap, smth.comparator)) {
smth.comparator = this.OperatorMap[smth.comparator];
}
......
......@@ -180,10 +180,10 @@ class AbstractQuery {
result = result && this.sql.toLowerCase().startsWith('insert into');
// is insert query if no results are passed or if the result has the inserted id
result = result && (!results || results.hasOwnProperty(this.getInsertIdField()));
result = result && (!results || Object.prototype.hasOwnProperty.call(results, this.getInsertIdField()));
// is insert query if no metadata are passed or if the metadata has the inserted id
result = result && (!metaData || metaData.hasOwnProperty(this.getInsertIdField()));
result = result && (!metaData || Object.prototype.hasOwnProperty.call(metaData, this.getInsertIdField()));
return result;
}
......@@ -262,7 +262,7 @@ class AbstractQuery {
let o = {};
for (const key in result) {
if (result.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(result, key)) {
o[key] = result[key];
}
}
......@@ -442,7 +442,7 @@ class AbstractQuery {
// Map each key to an include option
let previousPiece;
const buildIncludeMap = piece => {
if ($current.includeMap.hasOwnProperty(piece)) {
if (Object.prototype.hasOwnProperty.call($current.includeMap, piece)) {
includeMap[key] = $current = $current.includeMap[piece];
if (previousPiece) {
previousPiece = `${previousPiece}.${piece}`;
......@@ -455,7 +455,7 @@ class AbstractQuery {
// Calculate the string prefix of a key ('User.Results' for 'User.Results.id')
const keyPrefixStringMemo = {};
const keyPrefixString = (key, memo) => {
if (!memo.hasOwnProperty(key)) {
if (!Object.prototype.hasOwnProperty.call(memo, key)) {
memo[key] = key.substr(0, key.lastIndexOf('.'));
}
return memo[key];
......@@ -463,7 +463,7 @@ class AbstractQuery {
// Removes the prefix from a key ('id' for 'User.Results.id')
const removeKeyPrefixMemo = {};
const removeKeyPrefix = key => {
if (!removeKeyPrefixMemo.hasOwnProperty(key)) {
if (!Object.prototype.hasOwnProperty.call(removeKeyPrefixMemo, key)) {
const index = key.lastIndexOf('.');
removeKeyPrefixMemo[key] = key.substr(index === -1 ? 0 : index + 1);
}
......@@ -473,9 +473,9 @@ class AbstractQuery {
const keyPrefixMemo = {};
const keyPrefix = key => {
// We use a double memo and keyPrefixString so that different keys with the same prefix will receive the same array instead of differnet arrays with equal values
if (!keyPrefixMemo.hasOwnProperty(key)) {
if (!Object.prototype.hasOwnProperty.call(keyPrefixMemo, key)) {
const prefixString = keyPrefixString(key, keyPrefixStringMemo);
if (!keyPrefixMemo.hasOwnProperty(prefixString)) {
if (!Object.prototype.hasOwnProperty.call(keyPrefixMemo, prefixString)) {
keyPrefixMemo[prefixString] = prefixString ? prefixString.split('.') : [];
}
keyPrefixMemo[key] = keyPrefixMemo[prefixString];
......@@ -485,7 +485,7 @@ class AbstractQuery {
// Calcuate the last item in the array prefix ('Results' for 'User.Results.id')
const lastKeyPrefixMemo = {};
const lastKeyPrefix = key => {
if (!lastKeyPrefixMemo.hasOwnProperty(key)) {
if (!Object.prototype.hasOwnProperty.call(lastKeyPrefixMemo, key)) {
const prefix = keyPrefix(key);
const length = prefix.length;
......@@ -550,7 +550,7 @@ class AbstractQuery {
$keyPrefix = keyPrefix(key);
// On the first row we compute the includeMap
if (rowsI === 0 && !includeMap.hasOwnProperty(key)) {
if (rowsI === 0 && !Object.prototype.hasOwnProperty.call(includeMap, key)) {
if (!$keyPrefix.length) {
includeMap[key] = includeMap[''] = includeOptions;
} else {
......
......@@ -155,7 +155,7 @@ class Query extends AbstractQuery {
allowNull: _result.Null === 'YES',
defaultValue: _result.Default,
primaryKey: _result.Key === 'PRI',
autoIncrement: _result.hasOwnProperty('Extra')
autoIncrement: Object.prototype.hasOwnProperty.call(_result, 'Extra')
&& _result.Extra.toLowerCase() === 'auto_increment',
comment: _result.Comment ? _result.Comment : null
};
......@@ -201,7 +201,7 @@ class Query extends AbstractQuery {
continue;
}
for (const _warningResult of _warningRow) {
if (_warningResult.hasOwnProperty('Message')) {
if (Object.prototype.hasOwnProperty.call(_warningResult, 'Message')) {
messages.push(_warningResult.Message);
} else {
for (const _objectKey of _warningResult.keys()) {
......
......@@ -115,7 +115,7 @@ class MSSQLQueryGenerator extends AbstractQueryGenerator {
let commentStr = '';
for (const attr in attributes) {
if (attributes.hasOwnProperty(attr)) {
if (Object.prototype.hasOwnProperty.call(attributes, attr)) {
let dataType = attributes[attr];
let match;
......@@ -169,7 +169,7 @@ class MSSQLQueryGenerator extends AbstractQueryGenerator {
}
for (const fkey in foreignKeys) {
if (foreignKeys.hasOwnProperty(fkey)) {
if (Object.prototype.hasOwnProperty.call(foreignKeys, fkey)) {
attributesClause += `, FOREIGN KEY (${this.quoteIdentifier(fkey)}) ${foreignKeys[fkey]}`;
}
}
......
......@@ -365,7 +365,7 @@ class Query extends AbstractQuery {
let id = null;
let autoIncrementAttributeAlias = null;
if (this.model.rawAttributes.hasOwnProperty(autoIncrementAttribute) &&
if (Object.prototype.hasOwnProperty.call(this.model.rawAttributes, autoIncrementAttribute) &&
this.model.rawAttributes[autoIncrementAttribute].field !== undefined)
autoIncrementAttributeAlias = this.model.rawAttributes[autoIncrementAttribute].field;
......
......@@ -76,7 +76,7 @@ class MySQLQueryGenerator extends AbstractQueryGenerator {
const attrStr = [];
for (const attr in attributes) {
if (!attributes.hasOwnProperty(attr)) continue;
if (!Object.prototype.hasOwnProperty.call(attributes, attr)) continue;
const dataType = attributes[attr];
let match;
......@@ -127,7 +127,7 @@ class MySQLQueryGenerator extends AbstractQueryGenerator {
}
for (const fkey in foreignKeys) {
if (foreignKeys.hasOwnProperty(fkey)) {
if (Object.prototype.hasOwnProperty.call(foreignKeys, fkey)) {
attributesClause += `, FOREIGN KEY (${this.quoteIdentifier(fkey)}) ${foreignKeys[fkey]}`;
}
}
......
......@@ -125,7 +125,7 @@ class Query extends AbstractQuery {
allowNull: _result.Null === 'YES',
defaultValue: _result.Default,
primaryKey: _result.Key === 'PRI',
autoIncrement: _result.hasOwnProperty('Extra') && _result.Extra.toLowerCase() === 'auto_increment',
autoIncrement: Object.prototype.hasOwnProperty.call(_result, 'Extra') && _result.Extra.toLowerCase() === 'auto_increment',
comment: _result.Comment ? _result.Comment : null
};
}
......@@ -167,7 +167,7 @@ class Query extends AbstractQuery {
for (const _warningRow of warningResults) {
if (_warningRow === undefined || typeof _warningRow[Symbol.iterator] !== 'function') continue;
for (const _warningResult of _warningRow) {
if (_warningResult.hasOwnProperty('Message')) {
if (Object.prototype.hasOwnProperty.call(_warningResult, 'Message')) {
messages.push(_warningResult.Message);
} else {
for (const _objectKey of _warningResult.keys()) {
......
......@@ -388,8 +388,8 @@ module.exports = BaseTypes => {
}
const valueInclusivity = [true, false];
const valuesStringified = values.map((value, index) => {
if (_.isObject(value) && value.hasOwnProperty('value')) {
if (value.hasOwnProperty('inclusive')) {
if (_.isObject(value) && Object.prototype.hasOwnProperty.call(value, 'value')) {
if (Object.prototype.hasOwnProperty.call(value, 'inclusive')) {
valueInclusivity[index] = value.inclusive;
}
value = value.value;
......
......@@ -489,7 +489,7 @@ class PostgresQueryGenerator extends AbstractQueryGenerator {
let sql = type.toString();
if (attribute.hasOwnProperty('allowNull') && !attribute.allowNull) {
if (Object.prototype.hasOwnProperty.call(attribute, 'allowNull') && !attribute.allowNull) {
sql += ' NOT NULL';
}
......
......@@ -239,7 +239,7 @@ class Query extends AbstractQuery {
if (this.isInsertQuery() || this.isUpdateQuery()) {
if (this.instance && this.instance.dataValues) {
for (const key in rows[0]) {
if (rows[0].hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(rows[0], key)) {
const record = rows[0][key];
const attr = _.find(this.model.rawAttributes, attribute => attribute.fieldName === key || attribute.field === key);
......
......@@ -33,7 +33,7 @@ function stringify(data) {
if (!data.length) return 'empty';
if (data.length !== 2) throw new Error('range array length must be 0 (empty) or 2 (lower and upper bounds)');
if (data.hasOwnProperty('inclusive')) {
if (Object.prototype.hasOwnProperty.call(data, 'inclusive')) {
if (data.inclusive === false) data.inclusive = [false, false];
else if (!data.inclusive) data.inclusive = [true, false];
else if (data.inclusive === true) data.inclusive = [true, true];
......@@ -43,8 +43,8 @@ function stringify(data) {
_.each(data, (value, index) => {
if (_.isObject(value)) {
if (value.hasOwnProperty('inclusive')) data.inclusive[index] = !!value.inclusive;
if (value.hasOwnProperty('value')) data[index] = value.value;
if (Object.prototype.hasOwnProperty.call(value, 'inclusive')) data.inclusive[index] = !!value.inclusive;
if (Object.prototype.hasOwnProperty.call(value, 'value')) data[index] = value.value;
}
});
......
......@@ -28,7 +28,7 @@ class SQLiteQueryGenerator extends MySqlQueryGenerator {
const attrArray = [];
for (const attr in attributes) {
if (attributes.hasOwnProperty(attr)) {
if (Object.prototype.hasOwnProperty.call(attributes, attr)) {
const dataType = attributes[attr];
const containsAutoIncrement = dataType.includes('AUTOINCREMENT');
......@@ -290,7 +290,7 @@ class SQLiteQueryGenerator extends MySqlQueryGenerator {
if (_.isObject(dataType)) {
let sql = dataType.type.toString();
if (dataType.hasOwnProperty('allowNull') && !dataType.allowNull) {
if (Object.prototype.hasOwnProperty.call(dataType, 'allowNull') && !dataType.allowNull) {
sql += ' NOT NULL';
}
......
......@@ -140,7 +140,7 @@ class Query extends AbstractQuery {
});
}
return tableTypes.hasOwnProperty(name)
return Object.prototype.hasOwnProperty.call(tableTypes, name)
? this.applyParsers(tableTypes[name], value)
: value;
});
......
......@@ -138,7 +138,7 @@ class InstanceValidator {
this._validateSchema(rawAttribute, field, value);
}
if (this.modelInstance.validators.hasOwnProperty(field)) {
if (Object.prototype.hasOwnProperty.call(this.modelInstance.validators, field)) {
validators.push(this._singleAttrValidate(value, field, rawAttribute.allowNull).reflect());
}
});
......
......@@ -63,7 +63,7 @@ class ModelManager {
models[tableName] = model;
for (const attrName in model.rawAttributes) {
if (model.rawAttributes.hasOwnProperty(attrName)) {
if (Object.prototype.hasOwnProperty.call(model.rawAttributes, attrName)) {
const attribute = model.rawAttributes[attrName];
if (attribute.references) {
......
......@@ -139,7 +139,7 @@ class Model {
// do after default values since it might have UUID as a default value
if (this.constructor.primaryKeyAttributes.length) {
this.constructor.primaryKeyAttributes.forEach(primaryKeyAttribute => {
if (!defaults.hasOwnProperty(primaryKeyAttribute)) {
if (!Object.prototype.hasOwnProperty.call(defaults, primaryKeyAttribute)) {
defaults[primaryKeyAttribute] = null;
}
});
......@@ -201,7 +201,7 @@ class Model {
const deletedAtAttribute = model.rawAttributes[deletedAtCol];
const deletedAtObject = {};
let deletedAtDefaultValue = deletedAtAttribute.hasOwnProperty('defaultValue') ? deletedAtAttribute.defaultValue : null;
let deletedAtDefaultValue = Object.prototype.hasOwnProperty.call(deletedAtAttribute, 'defaultValue') ? deletedAtAttribute.defaultValue : null;
deletedAtDefaultValue = deletedAtDefaultValue || {
[Op.eq]: null
......@@ -299,7 +299,7 @@ class Model {
this.autoIncrementAttribute = null;
for (const name in this.rawAttributes) {
if (this.rawAttributes.hasOwnProperty(name)) {
if (Object.prototype.hasOwnProperty.call(this.rawAttributes, name)) {
const definition = this.rawAttributes[name];
if (definition && definition.autoIncrement) {
if (this.autoIncrementAttribute) {
......@@ -328,7 +328,7 @@ class Model {
static _transformStringAssociation(include, self) {
if (self && typeof include === 'string') {
if (!self.associations.hasOwnProperty(include)) {
if (!Object.prototype.hasOwnProperty.call(self.associations, include)) {
throw new Error(`Association with alias "${include}" does not exist`);
}
return self.associations[include];
......@@ -701,7 +701,7 @@ class Model {
}
// Validate child includes
if (include.hasOwnProperty('include')) {
if (Object.prototype.hasOwnProperty.call(include, 'include')) {
this._validateIncludedElements.call(include.model, include, tableNames);
}
......@@ -982,7 +982,7 @@ class Model {
// error check options
_.each(options.validate, (validator, validatorType) => {
if (attributes.hasOwnProperty(validatorType)) {
if (Object.prototype.hasOwnProperty.call(attributes, validatorType)) {
throw new Error(`A model validator function must not have the same name as a field. Model: ${this.name}, field/validation name: ${validatorType}`);
}
......@@ -1082,7 +1082,7 @@ class Model {
});
_.each(this.rawAttributes, (options, attribute) => {
if (options.hasOwnProperty(type)) {
if (Object.prototype.hasOwnProperty.call(options, type)) {
_custom[attribute] = options[type];
}
......@@ -1158,15 +1158,15 @@ class Model {
this._virtualAttributes.add(name);
}
if (definition.hasOwnProperty('defaultValue')) {
if (Object.prototype.hasOwnProperty.call(definition, 'defaultValue')) {
this._defaultValues[name] = () => Utils.toDefaultValue(definition.defaultValue, this.sequelize.options.dialect);
}
if (definition.hasOwnProperty('unique') && definition.unique) {
if (Object.prototype.hasOwnProperty.call(definition, 'unique') && definition.unique) {
let idxName;
if (
typeof definition.unique === 'object' &&
definition.unique.hasOwnProperty('name')
Object.prototype.hasOwnProperty.call(definition.unique, 'name')
) {
idxName = definition.unique.name;
} else if (typeof definition.unique === 'string') {
......@@ -1186,7 +1186,7 @@ class Model {
this.uniqueKeys[idxName] = idx;
}
if (definition.hasOwnProperty('validate')) {
if (Object.prototype.hasOwnProperty.call(definition, 'validate')) {
this.prototype.validators[name] = definition.validate;
}
......@@ -1225,7 +1225,7 @@ class Model {
this.prototype._hasCustomSetters = Object.keys(this.prototype._customSetters).length;
for (const key of Object.keys(attributeManipulation)) {
if (Model.prototype.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(Model.prototype, key)) {
this.sequelize.log(`Not overriding built-in method from model attribute: ${key}`);
continue;
}
......@@ -1233,7 +1233,7 @@ class Model {
}
this.prototype.rawAttributes = this.rawAttributes;
this.prototype._isAttribute = key => this.prototype.rawAttributes.hasOwnProperty(key);
this.prototype._isAttribute = key => Object.prototype.hasOwnProperty.call(this.prototype.rawAttributes, key);
// Primary key convenience constiables
this.primaryKeyAttributes = Object.keys(this.primaryKeys);
......@@ -1690,7 +1690,7 @@ class Model {
_.defaults(options, { hooks: true });
// set rejectOnEmpty option, defaults to model options
options.rejectOnEmpty = options.hasOwnProperty('rejectOnEmpty')
options.rejectOnEmpty = Object.prototype.hasOwnProperty.call(options, 'rejectOnEmpty')
? options.rejectOnEmpty
: this.options.rejectOnEmpty;
......@@ -2766,7 +2766,7 @@ class Model {
const deletedAtAttribute = this.rawAttributes[this._timestampAttributes.deletedAt];
const field = this.rawAttributes[this._timestampAttributes.deletedAt].field;
const where = {
[field]: deletedAtAttribute.hasOwnProperty('defaultValue') ? deletedAtAttribute.defaultValue : null
[field]: Object.prototype.hasOwnProperty.call(deletedAtAttribute, 'defaultValue') ? deletedAtAttribute.defaultValue : null
};
......@@ -2835,7 +2835,7 @@ class Model {
const attrValueHash = {};
const deletedAtCol = this._timestampAttributes.deletedAt;
const deletedAtAttribute = this.rawAttributes[deletedAtCol];
const deletedAtDefaultValue = deletedAtAttribute.hasOwnProperty('defaultValue') ? deletedAtAttribute.defaultValue : null;
const deletedAtDefaultValue = Object.prototype.hasOwnProperty.call(deletedAtAttribute, 'defaultValue') ? deletedAtAttribute.defaultValue : null;
attrValueHash[deletedAtAttribute.field || deletedAtCol] = deletedAtDefaultValue;
options.omitNull = false;
......@@ -3127,7 +3127,7 @@ class Model {
}
static hasAlias(alias) {
return this.associations.hasOwnProperty(alias);
return Object.prototype.hasOwnProperty.call(this.associations, alias);
}
/**
......@@ -3335,7 +3335,7 @@ class Model {
options = options || {};
if (key) {
if (this._customGetters.hasOwnProperty(key) && !options.raw) {
if (Object.prototype.hasOwnProperty.call(this._customGetters, key) && !options.raw) {
return this._customGetters[key].call(this, key, options);
}
......@@ -3369,14 +3369,17 @@ class Model {
continue;
}
if (this._customGetters.hasOwnProperty(_key)) {
if (Object.prototype.hasOwnProperty.call(this._customGetters, _key)) {
values[_key] = this.get(_key, options);
}
}
}
for (_key in this.dataValues) {
if (!values.hasOwnProperty(_key) && this.dataValues.hasOwnProperty(_key)) {
if (
!Object.prototype.hasOwnProperty.call(values, _key)
&& Object.prototype.hasOwnProperty.call(this.dataValues, _key)
) {
values[_key] = this.get(_key, options);
}
}
......@@ -3518,7 +3521,10 @@ class Model {
}
// If there's a data type sanitizer
if (!(value instanceof Utils.SequelizeMethod) && this.constructor._dataTypeSanitizers.hasOwnProperty(key)) {
if (
!(value instanceof Utils.SequelizeMethod)
&& Object.prototype.hasOwnProperty.call(this.constructor._dataTypeSanitizers, key)
) {
value = this.constructor._dataTypeSanitizers[key].call(this, value, options);
}
......@@ -4034,7 +4040,9 @@ class Model {
const values = Utils.mapValueFieldNames(this.dataValues, this.changed() || [], this.constructor);
values[field] = new Date();
where[field] = attribute.hasOwnProperty('defaultValue') ? attribute.defaultValue : null;
where[field] = Object.prototype.hasOwnProperty.call(attribute, 'defaultValue')
? attribute.defaultValue
: null;
this.setDataValue(field, values[field]);
......@@ -4073,7 +4081,7 @@ class Model {
}
const deletedAtAttribute = this.constructor.rawAttributes[this.constructor._timestampAttributes.deletedAt];
const defaultValue = deletedAtAttribute.hasOwnProperty('defaultValue') ? deletedAtAttribute.defaultValue : null;
const defaultValue = Object.prototype.hasOwnProperty.call(deletedAtAttribute, 'defaultValue') ? deletedAtAttribute.defaultValue : null;
const deletedAt = this.get(this.constructor._timestampAttributes.deletedAt) || null;
const isSet = deletedAt !== defaultValue;
......@@ -4105,7 +4113,7 @@ class Model {
}).then(() => {
const deletedAtCol = this.constructor._timestampAttributes.deletedAt;
const deletedAtAttribute = this.constructor.rawAttributes[deletedAtCol];
const deletedAtDefaultValue = deletedAtAttribute.hasOwnProperty('defaultValue') ? deletedAtAttribute.defaultValue : null;
const deletedAtDefaultValue = Object.prototype.hasOwnProperty.call(deletedAtAttribute, 'defaultValue') ? deletedAtAttribute.defaultValue : null;
this.setDataValue(deletedAtCol, deletedAtDefaultValue);
return this.save(Object.assign({}, options, { hooks: false, omitNull: false }));
......
......@@ -546,8 +546,8 @@ class Sequelize {
options = _.defaults(options, {
// eslint-disable-next-line no-console
logging: this.options.hasOwnProperty('logging') ? this.options.logging : console.log,
searchPath: this.options.hasOwnProperty('searchPath') ? this.options.searchPath : 'DEFAULT'
logging: Object.prototype.hasOwnProperty.call(this.options, 'logging') ? this.options.logging : console.log,
searchPath: Object.prototype.hasOwnProperty.call(this.options, 'searchPath') ? this.options.searchPath : 'DEFAULT'
});
if (!options.type) {
......@@ -1148,7 +1148,7 @@ class Sequelize {
const last = _.last(args);
if (last && _.isPlainObject(last) && last.hasOwnProperty('logging')) {
if (last && _.isPlainObject(last) && Object.prototype.hasOwnProperty.call(last, 'logging')) {
options = last;
// remove options from set of logged arguments if options.logging is equal to console.log
......@@ -1218,7 +1218,7 @@ class Sequelize {
attribute.type = this.normalizeDataType(attribute.type);
if (attribute.hasOwnProperty('defaultValue')) {
if (Object.prototype.hasOwnProperty.call(attribute, 'defaultValue')) {
if (typeof attribute.defaultValue === 'function' && (
attribute.defaultValue === DataTypes.NOW ||
attribute.defaultValue === DataTypes.UUIDV1 ||
......
......@@ -612,7 +612,7 @@ exports.defaults = defaults;
function nameIndex(index, tableName) {
if (tableName.tableName) tableName = tableName.tableName;
if (!index.hasOwnProperty('name')) {
if (!Object.prototype.hasOwnProperty.call(index, 'name')) {
const fields = index.fields.map(
field => typeof field === 'string' ? field : field.name || field.attribute
);
......
......@@ -47,8 +47,8 @@
"wkx": "^0.4.6"
},
"devDependencies": {
"@commitlint/cli": "^7.3.2",
"@commitlint/config-angular": "^7.3.1",
"@commitlint/cli": "^8.0.0",
"@commitlint/config-angular": "^8.0.0",
"@types/bluebird": "^3.5.26",
"@types/node": "^10.12.27",
"@types/validator": "^10.11.0",
......@@ -59,11 +59,11 @@
"chai-spies": "^1.x",
"continuation-local-storage": "^3.x",
"cross-env": "^5.2.0",
"env-cmd": "^8.0.0",
"env-cmd": "^9.0.3",
"esdoc": "^1.1.0",
"esdoc-inject-style-plugin": "^1.0.0",
"esdoc-standard-plugin": "^1.0.0",
"eslint": "^5.15.0",
"eslint": "^6.0.0",
"eslint-plugin-jsdoc": "^4.1.1",
"eslint-plugin-mocha": "^5.2.1",
"husky": "^1.3.1",
......@@ -71,19 +71,19 @@
"lcov-result-merger": "^3.0.0",
"lint-staged": "^8.1.5",
"mariadb": "^2.0.3",
"markdownlint-cli": "^0.14.1",
"mocha": "6.0.2",
"markdownlint-cli": "^0.17.0",
"mocha": "^6.1.4",
"mysql2": "^1.6.5",
"nyc": "^13.3.0",
"nyc": "^14.1.1",
"pg": "^7.8.1",
"pg-hstore": "^2.x",
"pg-types": "^2.0.0",
"rimraf": "^2.6.3",
"semantic-release": "^15.13.3",
"sinon": "7.2.6",
"sinon-chai": "3.2.0",
"semantic-release": "^15.13.16",
"sinon": "^7.3.2",
"sinon-chai": "^3.3.0",
"sqlite3": "^4.0.6",
"tedious": "^6.0.0",
"tedious": "6.0.0",
"typescript": "^3.3.3333"
},
"keywords": [
......
......@@ -3,6 +3,7 @@
"no-invalid-this": 0,
"no-unused-expressions": 0,
"camelcase": 0,
"no-console": 0
"no-console": 0,
"no-prototype-builtins": 0
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!