Browse Source

started conversion to ES6

pull/712/head
Stephen Hess 8 years ago
parent
commit
307fce8079
  1. 6
      middleware/trimByGranularityComponent.js
  2. 2
      sanitizer/_synthesize_analysis.js

6
middleware/trimByGranularityComponent.js

@ -40,13 +40,13 @@ function isFallbackQuery(results) {
}
function hasRecordsAtLayers(results, layer) {
return results.some(function(result) {
return results.some( (result) => {
return result._matched_queries[0] === 'fallback.' + layer;
});
}
function retainRecordsAtLayers(results, layer) {
return results.filter(function(result) {
return results.filter( (result) => {
return result._matched_queries[0] === 'fallback.' + layer;
});
}
@ -61,7 +61,7 @@ function setup() {
// start at the most granular possible layer. if there are results at a layer
// then remove everything not at that layer.
layers.forEach(function(layer) {
layers.forEach( (layer) => {
if (hasRecordsAtLayers(res.data, layer )) {
res.data = retainRecordsAtLayers(res.data, layer);
}

2
sanitizer/_synthesize_analysis.js

@ -13,7 +13,7 @@ function sanitize( raw, clean ){
var messages = { errors: [], warnings: [] };
// collect all the valid values into a single object
clean.parsed_text = fields.reduce(function(o, f) {
clean.parsed_text = fields.reduce( (o, f) => {
if (_.isString(raw[f]) && !_.isEmpty(_.trim(raw[f]))) {
o[f] = normalizeWhitespaceToSingleSpace(raw[f]);
}

Loading…
Cancel
Save