<commit_before>
var through = require('through2');

var stream = through.obj( function( node, enc, done ) {

  // filter nodes missing mandatory properties
  if( !node || !node.hasOwnProperty('id')
            || !node.hasOwnProperty('lat')
            || !node.hasOwnProperty('lon')
            || 'object' !== typeof node.tags
            || !Object.keys( node.tags ).length ) return done();
  
  // filter nodes which are not a desirable feature type
  if( hasFeature( node ) ){
    this.push( node, enc );
  }

  done();
});

var features = ( 'amenity building shop office public_transport cuisine railway sport natural tourism ' +
                 'leisure historic man_made landuse waterway aerialway aeroway craft military' ).split(' ');

function hasFeature( node ){
  for( var x=0; x<features.length; x++ ){
    if( node.tags.hasOwnProperty( features[x] ) ) return true;<commit_msg>simplify syntax<commit_after>
var through = require('through2');
var stream = through.obj( function( data, enc, done ) {

  // filter nodes missing requires properties
  if( node && node.hasOwnProperty('id')
           && node.hasOwnProperty('lat')
           && node.hasOwnProperty('lon')
           && 'object' == typeof node.tags
           && !!Object.keys( node.tags ).length
           && hasFeature( node ) ){
    this.push( node );
  }

  return done();
});

var features = ( 'amenity building shop office public_transport cuisine railway sport natural tourism ' +
                 'leisure historic man_made landuse waterway aerialway aeroway craft military' ).split(' ');

function hasFeature( node ){
  for( var x=0; x<features.length; x++ ){
    if( node.tags.hasOwnProperty( features[x] ) ) return true;
{'fraction_non_alphanumeric': 0.1347393087287639, 'fraction_numerical': 0.0023432923257176333, 'mean_word_length': 3.0473933649289098, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5272175', 'n_tokens_mistral': 480, 'n_tokens_neox': 474, 'n_words': 148}