leaflet- styling polyline layers correctly

by grant

HTML

<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A==" crossorigin=""/>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js" integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA==" crossorigin=""></script>
<div id="map" style="height:100vh; width: 100vw"></div>

CSS

html, body {
    height: 100%;
    margin: 0;
}

JavaScript

var freeBus = {
	"type": "FeatureCollection",
	"features": [
		{
			"type": "Feature",
			"geometry": {
				"type": "LineString",
				"coordinates": [
					[-105.00341892242432, 39.75383843460583],
					[-105.0008225440979, 39.751891803969535]
				]
			},
			"properties": {
				"popupContent": "This is a free bus line that will take you across downtown.",
				"underConstruction": true
			},
			"id": 1
		},
		{
			"type": "Feature",
			"geometry": {
				"type": "LineString",
				"coordinates": [
					[-105.0008225440979, 39.751891803969535],
					[-104.99820470809937, 39.74979664004068]
				]
			},
			"properties": {
				"popupContent": "This is a free bus line that will take you across downtown.",
				"underConstruction": true
			},
			"id": 2
		},
		{
			"type": "Feature",
			"geometry": {
				"type": "LineString",
				"coordinates": [
					[-104.99820470809937, 39.74979664004068],
					[-104.98689651489258, 39.741052354709055]
				]
			},
			"properties": {
				"popupContent": "This is a free bus line that will take you across downtown.",
				"underConstruction": false
			},
			"id": 3
		}
	]
};
var map = L.map('map').setView([39.74739, -105], 13);

L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
	maxZoom: 18,
	attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, ' +
	'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
	id: 'mapbox/light-v9',
	tileSize: 512,
	zoomOffset: -1
}).addTo(map);

function busStyle(feature) {
  return {
    stroke: filter(feature)
  };
}

function filter(feature, layer) {
	if (feature.properties) {
		if ( feature.properties.underConstruction === undefined || feature.properties.underConstruction === false ) {
			return false
		} else {
			return true
		}
	}
}

const layer = L.geoJSON(freeBus, {
	style:...