From f4a5dd812b43d9ba3097ffd851c692f471c344e1 Mon Sep 17 00:00:00 2001 From: Julian Simioni Date: Tue, 9 Feb 2016 11:31:29 -0500 Subject: [PATCH] Replace depricated Lodash function contains with includes See https://github.com/lodash/lodash/wiki/Changelog#jan-12-2016--diff--docs --- helper/adminFields.js | 2 +- helper/geojsonify.js | 10 +++++----- helper/labelGenerator.js | 2 +- sanitiser/_details.js | 2 +- sanitiser/_flag_bool.js | 2 +- sanitiser/_groups.js | 4 ++-- sanitiser/_ids.js | 6 +++--- sanitiser/_source.js | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/helper/adminFields.js b/helper/adminFields.js index af6ac432..31648bc4 100644 --- a/helper/adminFields.js +++ b/helper/adminFields.js @@ -32,7 +32,7 @@ function getAvailableAdminFields(schema, expectedFields, logger) { // check if expected fields are actually in current schema var available = expectedFields.filter(function (field) { - return _.contains( actualFields, field ); + return _.includes( actualFields, field ); }); if (available.length === 0) { diff --git a/helper/geojsonify.js b/helper/geojsonify.js index d01b6f36..d77792ee 100644 --- a/helper/geojsonify.js +++ b/helper/geojsonify.js @@ -35,10 +35,10 @@ function lookupSource(src) { */ function lookupLayer(src) { if (src._type === 'geoname') { - if (_.contains(src.category, 'admin')) { - if (_.contains(src.category, 'admin:city')) { return 'locality'; } - if (_.contains(src.category, 'admin:admin1')) { return 'region'; } - if (_.contains(src.category, 'admin:admin2')) { return 'county'; } + if (_.includes(src.category, 'admin')) { + if (_.includes(src.category, 'admin:city')) { return 'locality'; } + if (_.includes(src.category, 'admin:admin1')) { return 'region'; } + if (_.includes(src.category, 'admin:admin2')) { return 'county'; } return 'neighbourhood'; // this could also be 'local_admin' } @@ -46,7 +46,7 @@ function lookupLayer(src) { if (src.address) { return 'address'; } } - if (_.contains(type_mapping.types, src._type)) { + if (_.includes(type_mapping.types, src._type)) { return type_mapping.type_to_layer[src._type]; } diff --git a/helper/labelGenerator.js b/helper/labelGenerator.js index 1938232d..422c3409 100644 --- a/helper/labelGenerator.js +++ b/helper/labelGenerator.js @@ -16,7 +16,7 @@ module.exports = function( record ){ var buildOutput = function(parts, schemaArr, record) { for (var i=0; i 0 ){