JSFiddle - React, Tailwind, and code Playground

by neonDog

JavaScript

const layerNameWhitelist = ['image', 'camera', 'dynamic-light', 'model','particle'];

const name = 'poo particle';

layerNameWhitelist.forEach(function(v,i) {
    if (name.toLowerCase().indexOf(v) >= 0) {
      	type = layerNameWhitelist[i];
    }
});

console.log(type);