Do not use array.includes to support some older versions of node

This commit is contained in:
Andris Reinman 2016-12-08 13:49:31 +02:00
parent 005941731b
commit 37b0ac9aec
3 changed files with 3 additions and 3 deletions

View file

@ -108,7 +108,7 @@ module.exports.get = (id, callback) => {
return callback(err);
}
let field = rows && rows[0] && tools.convertKeys(rows[0]) || false;
field.isGroup = module.exports.grouped.includes(field.type) || field.type === 'json';
field.isGroup = module.exports.grouped.indexOf(field.type) >= 0 || field.type === 'json';
return callback(null, field);
});
});

View file

@ -304,7 +304,7 @@ router.post('/field/:listId', (req, res) => {
type: (input.TYPE || '').toString().toLowerCase().trim(),
group: Number(input.GROUP) || null,
groupTemplate: (input.GROUP_TEMPLATE || '').toString().toLowerCase().trim(),
visible: !['false', 'no', '0', ''].includes((input.VISIBLE || '').toString().toLowerCase().trim())
visible: ['false', 'no', '0', ''].indexOf((input.VISIBLE || '').toString().toLowerCase().trim()) < 0
};
fields.create(list.id, field, (err, id, tag) => {

View file

@ -111,7 +111,7 @@ module.exports = callback => {
let hosts;
if (typeof config.verp.host === 'string' && config.verp.host) {
hosts = config.verp.host.trim().split(',').map(host => host.trim()).filter(host => host.trim());
if (hosts.includes('*') || hosts.includes('all')) {
if (hosts.indexOf('*') >= 0 || hosts.indexOf('all') >= 0) {
hosts = [false];
}
} else {