3rd-Eden / useragent

Useragent parser for Node.js, ported from browserscope.org
MIT License
897 stars 137 forks source link

satisfies is not a function #80

Open skerit opened 9 years ago

skerit commented 9 years ago

Sometimes satisfies is not a function in this code:

// Get the user agent string from the headers
uaString = headers['user-agent'];

// Start parsing the string
is = useragent.is(uaString);
agent = useragent.parse(uaString);

if (typeof agent.satisfies != 'function') {
    console.log('Satisfies is not a function?', headers, uaString, is, agent);
}

The input uaString would be a regular useragent like:

Mozilla/5.0 (X11; Linux x86_64; rv:40.0) Gecko/20100101 Firefox/40.0

The agent object IS an Agent instance, though, and looks like this:

{
    family: "Firefox",
    major: "40",
    minor: "0",
    patch: "0",
    source: "Mozilla/5.0 (X11; Linux x86_64; rv:40.0) Gecko/20100101 Firefox/40.0"
}