flatiron / www

The public web presence for flatiron
http://flatironjs.org
12 stars 10 forks source link

Couple of minor typos #10

Open am-a opened 11 years ago

am-a commented 11 years ago

Hopefully highlighted in bold...

What problem does it solve?

This plugin model translates well between the browser and the server because developers can write different plugins to suite > suit the needs of the different environments.

function middleware1(req, res) {
  if(~req.url.indexOf('foo')) {
    return false;
  }
}

What's that before the req?

AndreArtus commented 9 years ago

@am-a, are you referring to the tilde (~) in if(~req.url.indexOf('foo'))? If so that is the JavaScript equivalent of bitwise not, or [one's] complement. It is in essence a shortened version of if(req.url.indexOf('foo') > -1) or if(~req.url.indexOf('foo') >= 0).

While it is in broad use it has its detractors, and I include myself among them.