Browse Source

Merge pull request #1015 from pelias/remove-extend-dependency

Remove extend dependency
pull/1016/head
Stephen K Hess 7 years ago committed by GitHub
parent
commit
9249bf0d49
  1. 3
      helper/type_mapping.js
  2. 3
      middleware/geocodeJSON.js
  3. 1
      package.json
  4. 9
      sanitizer/_text_addressit.js

3
helper/type_mapping.js

@ -1,5 +1,4 @@
var extend = require('extend'),
_ = require('lodash');
const _ = require('lodash');
function addStandardTargetsToAliases(standard, aliases) {
var combined = _.extend({}, aliases);

3
middleware/geocodeJSON.js

@ -1,5 +1,4 @@
var url = require('url');
var extend = require('extend');
var geojsonify = require('../helper/geojsonify');
var _ = require('lodash');
@ -74,7 +73,7 @@ function convertToGeocodeJSON(req, res, next, opts) {
res.body.geocoding.timestamp = new Date().getTime();
// convert docs to geojson and merge with geocoding block
extend(res.body, geojsonify(req.clean, res.data || []));
_.extend(res.body, geojsonify(req.clean, res.data || []));
next();
}

1
package.json

@ -44,7 +44,6 @@
"elasticsearch": "^13.0.0",
"elasticsearch-exceptions": "0.0.4",
"express": "^4.8.8",
"extend": "^3.0.1",
"geojson": "^0.5.0",
"@mapbox/geojson-extent": "^0.3.1",
"geolib": "^2.0.18",

9
sanitizer/_text_addressit.js

@ -1,6 +1,5 @@
var check = require('check-types');
var parser = require('addressit');
var extend = require('extend');
var _ = require('lodash');
var logger = require('pelias-logger').get('api');
@ -82,8 +81,8 @@ function parse(query) {
var addressWithAdminParts = getAdminPartsBySplittingOnDelim(queryParts);
var addressWithAddressParts= getAddressParts(queryParts.join(DELIM + ' '));
var parsedAddress = extend(addressWithAdminParts,
addressWithAddressParts);
// combine the 2 objects
_.extend(addressWithAdminParts, addressWithAddressParts);
var address_parts = [ 'name',
'number',
@ -99,8 +98,8 @@ function parse(query) {
var parsed_text = {};
address_parts.forEach(function(part){
if (parsedAddress[part]) {
parsed_text[part] = parsedAddress[part];
if (addressWithAdminParts[part]) {
parsed_text[part] = addressWithAdminParts[part];
}
});

Loading…
Cancel
Save