changeset 482:f3a8e2284a87

Remove console log and tighten object member check.
author Lucas Thompson <dev@lucas.im>
date Fri, 21 Jul 2017 17:12:11 +0100
parents 7253d73ac7c9
children 90c7a8bfe519
files src/app/visualisations/FeatureUtilities.ts
diffstat 1 files changed, 7 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/app/visualisations/FeatureUtilities.ts	Fri Jul 21 16:22:51 2017 +0100
+++ b/src/app/visualisations/FeatureUtilities.ts	Fri Jul 21 17:12:11 2017 +0100
@@ -129,14 +129,14 @@
 
 const rdfTypes = {
   'http://purl.org/ontology/af/Note': 'notes',
-//  'http://purl.org/ontology/af/StructuralSegment': 'segments'
-}
+//  'http://purl.org/ontology/af/StructuralSegment': 'segments' // TODO segments
+};
 
 const throwShapeError = () => { throw new Error('No shape could be deduced'); };
 
 function deduceHigherLevelFeatureShape(response: SimpleResponse)
 : HigherLevelFeatureShape {
-  
+
   const collection = response.features;
   const descriptor = response.outputDescriptor;
   if (hasKnownShapeOtherThanList(collection.shape)) {
@@ -163,19 +163,17 @@
 
   if (descriptor.static) {
     const typeURI = descriptor.static.typeURI;
-    if (typeURI &&
-        typeURI !== "" &&
-        typeof (rdfTypes[typeURI]) !== 'undefined') {
+    if (typeof typeURI === 'string' && typeof rdfTypes[typeURI] === 'string') {
       return rdfTypes[typeURI];
     }
   }
 
   const isRegionLike = hasDuration &&
     (featureData.length > 0 && featureData[0].timestamp != null);
-  
+
   const isMaybeNote = getCanonicalNoteLikeUnit(descriptor.configured.unit)
     && [1, 2].find(nBins => nBins === binCount);
-  
+
   if (isRegionLike) {
     if (isMaybeNote) {
       return 'notes';
@@ -183,7 +181,7 @@
       return 'regions';
     }
   }
-  
+
   throwShapeError();
 }
 
@@ -269,8 +267,6 @@
     max = 1;
   }
 
-  console.log("range min = " + min + ", max = " + max);
-    
   return {
     data: winnowed.map(feature => {
       let duration = 0;