Create a function that takes a string and returns an object. The returned object will have a common property for all detected type content named contentType the possible values for this property are "HTML", "CSS", "TEXT".
cssTargets. cssTargets is an object with all content targets name and how many times these tags were called in content (see example #2).lineNumber (see example #1).analyzeContent("this is a test\nSeems to work")
➞ { contentType: "TEXT", lineNumber: 2 }
analyzeContent("body{blabla} a{color:#fff} a{ padding:0}")
➞ { contentType: "CSS", cssTargets: { body: 1, a: 2 } }
analyzeContent("<html><div></div><div></div></html>")
➞ { contentType: "HTML", tags: { html: 1, div: 2 } }
cssTargets property and lineNumber property and that's same for type of detection. Only the common proprety contentType stay inside the returned object.<!DOCTYPE html> and comments shoudn't be detected.